Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  So now we're on a microbenchmarking spree  (Read 4200 times)
0 Members and 1 Guest are viewing this topic.
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #30 - Posted 2004-04-28 04:37:04 »

Uh uh diggin up a dead thread Smiley

There is a little glitch in the Test class. public void math() uses a long for the result (instead of a double). The massive amount of casting makes it ~25% slower than it has to be. Before it was 1:6 and now it's about 1:4.5.

Well, Math got faster and FMath isn't "17.6 times faster than Math" anymore, but it's still faster and might be a measurable difference in your application.

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #31 - Posted 2004-04-28 13:06:05 »

Hmmm, I'm quite sure I fixed that when I measured it. I print the results and they were approx. the same. Lemme run it again  Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #32 - Posted 2004-04-29 10:35:31 »

I checked and re-ran the benchmark.
On the client, I'm getting FMath being ~6.2 times as fast, on the server about ~22.8 times as fast.

This is on 1.4.2_03

[EDIT:]
BTW, it's of course not really a comparitive test since Math obviously has far greater precision but it might indicate what kind of performance you could gain by settling for slightly inaccurate results.
That said, I suggest to always use Math, and switch to something like FMath if (after profiling) it's clear that Math causes a major bottleneck and that FMath's inaccuracies are within bounds of acceptability.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #33 - Posted 2004-04-29 16:00:26 »

Quote
[...]
That said, I suggest to always use Math, and switch to something like FMath if (after profiling) it's clear that Math causes a major bottleneck and that FMath's inaccuracies are within bounds of acceptability.


Yea, of corse Smiley

In my current case I'll only have one class wich uses some basic math relativly often. Therefore I can just try it out without too much hassle.

One thing wich is rather odd: with C/C++ lookup tables are slower then doing it the proper way, because lookup tables needs to execute more commands. Well, it's more inaccurate than the über accurate java way in double precision. I wish there would be a float math lib and a hotspot compiler wich knows about it, too.

That would be pretty awesome Smiley

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #34 - Posted 2004-04-29 21:35:27 »

I think many things are slower to do using look-up tables these days (CPU's being much faster than memory), unless they are very processor intensive tasks. Especially in java, because of its bounds checks.
In the old days I used look-up tables everywhere. Now only in some circumstances.
And yes, a fast, less accurate Math lib like you described (or a even a switch) would be awesome.
I wish nobody noticed java's slight 'inaccuracy' with sin/cos in 1.3  Grin

Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (71 views)
2014-11-26 15:22:04

toopeicgaming1999 (60 views)
2014-11-26 15:20:36

toopeicgaming1999 (14 views)
2014-11-26 15:20:08

SHC (27 views)
2014-11-25 12:00:59

SHC (25 views)
2014-11-25 11:53:45

Norakomi (31 views)
2014-11-25 11:26:43

Gibbo3771 (25 views)
2014-11-24 19:59:16

trollwarrior1 (38 views)
2014-11-22 12:13:56

xFryIx (77 views)
2014-11-13 12:34:49

digdugdiggy (55 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!