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
Recent
Compiler raised internal ...
by
TYDQ
[
Today
at 03:27:23 am]
I can write your README.m...
by
schuler
[
Today
at 03:13:59 am]
Periodic Table
by
440bx
[
Today
at 01:56:31 am]
Chat gpt is designed to l...
by
Joanna from IRC
[
Today
at 01:41:16 am]
Problema ao Instalar BGRA...
by
Fred vS
[May 18, 2025, 11:46:48 pm]
crtbeginS.o and crtendS.o...
by
Aruna
[May 18, 2025, 11:38:30 pm]
BGRA Controls
by
Fred vS
[May 18, 2025, 11:33:52 pm]
External ACCESS VIOLATION...
by
alpine
[May 18, 2025, 11:30:10 pm]
Icon file was loaded on m...
by
n7800
[May 18, 2025, 10:26:06 pm]
PascalScada installing
by
jamie
[May 18, 2025, 10:24:44 pm]
Build mode Help button do...
by
440bx
[May 18, 2025, 10:20:17 pm]
Negative offset
by
ASerge
[May 18, 2025, 10:16:37 pm]
Feature request/suggestio...
by
440bx
[May 18, 2025, 10:15:56 pm]
64 bits and PascalScript
by
jamie
[May 18, 2025, 10:10:03 pm]
A little bug in fpsimages...
by
Roni Wolf
[May 18, 2025, 09:38:07 pm]
Please post your ptop con...
by
Crispy Lettuce
[May 18, 2025, 08:29:57 pm]
BGRAGtkBitmap
by
CM630
[May 18, 2025, 08:04:12 pm]
FPC for high-performance ...
by
Fibonacci
[May 18, 2025, 07:55:58 pm]
New version of BGRABitmap
by
circular
[May 18, 2025, 06:28:42 pm]
FPC 3.2.2 - compilerproc ...
by
Thaddy
[May 18, 2025, 05:48:02 pm]
LazUpdateManager – Lazaru...
by
babycode
[May 18, 2025, 04:38:06 pm]
WPARAM definition
by
Thaddy
[May 18, 2025, 04:16:52 pm]
FPC 3.2.2 - Align for Ans...
by
marcov
[May 18, 2025, 03:36:05 pm]
Little Red Riding Hood (t...
by
Lulu
[May 18, 2025, 03:00:19 pm]
Hnefatafl Viking-Chess(ra...
by
Jonax
[May 18, 2025, 11:50:30 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Asm.js optimizations (Read 2694 times)
lainz
Hero Member
Posts: 4713
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: 4713
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