Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
Pas2JS
»
Asm.js optimizations
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
WIKI Timeout issues
Please read here if you have trouble connecting to the wiki
Recent
VOLKSWAGEN из Кореи
by
BruceDirty
[
Today
at 05:37:30 pm]
Output buffer to audio.
by
Fred vS
[
Today
at 05:34:55 pm]
Linux - partly off topic...
by
Martin_fr
[
Today
at 05:23:49 pm]
Firebird 5.02. - the root...
by
rvk
[
Today
at 04:55:39 pm]
[ZeosDBO/TZQuery] Passing...
by
rdxdt
[
Today
at 04:54:10 pm]
How do I drag/move a fram...
by
Warfley
[
Today
at 04:00:05 pm]
TCombobox causes Access V...
by
Hansaplast
[
Today
at 03:47:15 pm]
Nothing but chaotic attem...
by
Nicole
[
Today
at 03:18:37 pm]
TimageList - Lazarus 4 wi...
by
Nicole
[
Today
at 03:10:55 pm]
InstallAware 2025 Sources...
by
docno
[
Today
at 02:45:52 pm]
Fast Canvas Library V1.0
by
TBMan
[
Today
at 02:38:56 pm]
I created a Hello World p...
by
paweld
[
Today
at 01:56:08 pm]
Reading Embeded PO Files
by
Bart
[
Today
at 01:34:25 pm]
32-Bit MS-DOS Application...
by
marcov
[
Today
at 01:23:34 pm]
functional IF
by
creaothceann
[
Today
at 01:09:43 pm]
What is your favorite "bu...
by
cdbc
[
Today
at 11:32:49 am]
TStringGrid.VisibleColCou...
by
wp
[
Today
at 10:57:24 am]
Gateway Timeouts
by
Marc
[
Today
at 09:58:47 am]
Animated toggle switch
by
cdbc
[
Today
at 08:41:11 am]
StringGrid - How to force...
by
CM630
[
Today
at 07:50:59 am]
Pasdoc and Lazarus
by
440bx
[
Today
at 05:10:23 am]
[AGREED] processing web f...
by
Leledumbo
[
Today
at 04:28:13 am]
Testers required for LAMW...
by
nicelybrewed
[
Today
at 12:38:21 am]
IDE/ New Plugin
by
anderbelluno
[
Today
at 12:19:10 am]
Compiler can't find a (fa...
by
cdbc
[June 12, 2025, 11:35:34 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Asm.js optimizations (Read 2704 times)
lainz
Hero Member
Posts: 4721
Web, Desktop & Android developer
Asm.js optimizations
«
on:
April 13, 2019, 09:19:46 pm »
Asm.js
https://en.wikipedia.org/wiki/Asm.js
Is the pas2js output javascript code optimized like is described in that wiki article, for example:
Code: C
[Select]
[+]
[-]
int
f
(
int
i
)
{
return
i
+
1
;
}
That in Pascal is something like:
Code: Pascal
[Select]
[+]
[-]
function
f
(
i
:
integer
)
:
integer
;
begin
Result
:
=
i
+
1
;
end
;
And translated to Asm.js
Code: Javascript
[Select]
[+]
[-]
function
f
(
i
)
{
i
=
i
|
0
;
return
(
i
+
1
)
|
0
;
}
The extra "|0" converts the variables to int32 acording to the article, so it doesn't use floating point math.
«
Last Edit: April 13, 2019, 09:24:29 pm by Lainz
»
Logged
https://lainz.github.io/
mattias
Administrator
Full Member
Posts: 203
Re: Asm.js optimizations
«
Reply #1 on:
April 13, 2019, 10:08:28 pm »
No, but it would be possible to add an option to do so.
I did not take a look what other conversions are needed, so I can't estimate how much work it is.
Logged
lainz
Hero Member
Posts: 4721
Web, Desktop & Android developer
Re: Asm.js optimizations
«
Reply #2 on:
April 13, 2019, 11:43:00 pm »
Hi thanks for the quick response.
Ok it will be great and another reason to choose pas2js instead of emscriptem.
Logged
https://lainz.github.io/
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Networking and Web Programming
»
Pas2JS
»
Asm.js optimizations
TinyPortal
© 2005-2018