[Factor-talk] Speedup to math.functions round

2013-03-26 Thread Loryn Jenkins
Hi

I just noticed that math.functions round can be sped up. Compare the
version from math.functions vs the comparison version.

: round ( x -- y ) dup sgn 2 / + truncate ; inline
: round2 ( x -- y ) dup sgn 0.5 * + truncate ; inline

Testing = warm up execution of each statement, followed by 3 executions of
gc [ 1 [ 42.3 round drop ] times ] time
gc [ 1 [ 42.3 round2 drop ] times ] time

round results = { 0.004365148 0.004394427 0.001917139 } average = 0.0036
round2 results = { 0.001903133 0.001894752 0.001913334 } average = 0.0019

averaged results show 1.89 times speedup

on
Mac OS X 10.8.3
2 GHz Intel Core 2 Duo


Loryn Jenkins
--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Speedup to math.functions round

2013-03-26 Thread Loryn Jenkins
Apologies. This version contains amended run data.


Hi

I just noticed that math.functions round can be sped up. Compare the
version from math.functions vs the comparison version.

: round ( x -- y ) dup sgn 2 / + truncate ; inline
: round2 ( x -- y ) dup sgn 0.5 * + truncate ; inline

Testing = warm up execution of each statement, followed by 3 executions of
gc [ 1 [ 42.3 round drop ] times ] time
gc [ 1 [ 42.3 round2 drop ] times ] time

round results = { 0.004365148 0.004394427 0.004361589 } average = 0.0044
round2 results = { 0.001903133 0.001894752 0.001913334 } average = 0.0019

averaged results show 2.32 times speedup

on
Mac OS X 10.8.3
2 GHz Intel Core 2 Duo


Loryn Jenkins
--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Speedup to math.functions round

2013-03-26 Thread John Benediktsson
Nice!

I opened a bug to track this (not only to make the fix, but perhaps the
other case is slower than it needs to be and we can fix it).

https://github.com/slavapestov/factor/issues/819


On Tue, Mar 26, 2013 at 11:28 AM, Loryn Jenkins lor...@gmail.com wrote:

 Hi

 I just noticed that math.functions round can be sped up. Compare the
 version from math.functions vs the comparison version.

 : round ( x -- y ) dup sgn 2 / + truncate ; inline
 : round2 ( x -- y ) dup sgn 0.5 * + truncate ; inline

 Testing = warm up execution of each statement, followed by 3 executions of
 gc [ 1 [ 42.3 round drop ] times ] time
 gc [ 1 [ 42.3 round2 drop ] times ] time

 round results = { 0.004365148 0.004394427 0.001917139 } average = 0.0036
 round2 results = { 0.001903133 0.001894752 0.001913334 } average = 0.0019

 averaged results show 1.89 times speedup

 on
 Mac OS X 10.8.3
 2 GHz Intel Core 2 Duo


 Loryn Jenkins


 --
 Own the Future-Intelreg; Level Up Game Demo Contest 2013
 Rise to greatness in Intel's independent game demo contest.
 Compete for recognition, cash, and the chance to get your game
 on Steam. $5K grand prize plus 10 genre and skill prizes.
 Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Back to the future

2013-03-26 Thread Fox McCloud
Some ideas reminiscent of philosophies of Factor ...

http://www.youtube.com/watch?v=tc4ROCJYbm0
--
Own the Future-Intelreg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk