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
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
FPC 3.2.4-rc1 available
by
440bx
[
Today
at 06:08:35 am]
TChart how setup nicestep...
by
eldonfsr
[
Today
at 05:18:14 am]
I hope FreePascal can sup...
by
xiyi0616
[
Today
at 04:27:17 am]
AI assisted translation o...
by
schuler
[
Today
at 03:07:59 am]
Little bit...
by
ASerge
[
Today
at 12:48:46 am]
Can I get the position an...
by
wp
[
Today
at 12:23:04 am]
Translate .lfm file in a ...
by
wp
[
Today
at 12:07:11 am]
Playing video without to ...
by
n7800
[April 17, 2026, 11:51:39 pm]
Delimited text - how find...
by
n7800
[April 17, 2026, 11:28:25 pm]
overloading issues fpc3.2...
by
Martin_fr
[April 17, 2026, 10:21:07 pm]
Ann: Deinline: a de-inlin...
by
LeP
[April 17, 2026, 09:58:08 pm]
FPC Unleashed (inline var...
by
440bx
[April 17, 2026, 08:38:11 pm]
Seeking advice on setting...
by
schuler
[April 17, 2026, 03:36:28 pm]
Ann: DeCoperators
by
DomingoGP
[April 17, 2026, 03:23:39 pm]
Error: Compilation raised...
by
marcov
[April 17, 2026, 02:44:06 pm]
TLazSerial : serial port ...
by
CM630
[April 17, 2026, 09:50:34 am]
[Solved] Help needed comp...
by
landolfi
[April 17, 2026, 02:45:10 am]
DataPort or Synpase stat...
by
eldonfsr
[April 16, 2026, 11:32:18 pm]
[FPC 3.2.4, Windows] PTC ...
by
Fred vS
[April 16, 2026, 08:26:24 pm]
Cannot build Units for Si...
by
NormanDunbar
[April 16, 2026, 07:39:07 pm]
IDE: Property editor does...
by
dsiders
[April 16, 2026, 07:04:22 pm]
What is wrong with this c...
by
OH1KH
[April 16, 2026, 04:32:48 pm]
[work arounded]Naming dae...
by
LeP
[April 16, 2026, 03:36:10 pm]
Lazarus Bugfix Release 4....
by
Jonax
[April 16, 2026, 03:06:25 pm]
CudaText editor (written ...
by
AlexTP
[April 16, 2026, 10:43:12 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Asm.js optimizations (Read 2990 times)
lainz
Hero Member
Posts: 4742
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: 210
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: 4742
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