Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Unfortunately it depends a lot on the structure of the query. The lower the "frequency" of the noise, the faster it performs. In the worst case scenario (frequency larger than 4 datapoints per pixel) it will behave the same as the old noise generator, but with an added penalty of data structure preparation. Luckily for us MCServer uses much lesser frequencies, so it should still be a speedup.
Tomorrow I'll try to twist my brain around the 3D version of this.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
More knowledge
On x86, there's no measurable difference between using a double and a float for the noise functions.
But on ARM, there's a 20% performance increase when using floats. So we'll be sticking to floats for now.
If anyone could compile and run the $/Tests/NoiseTest project on x64 with both NOISE_DATATYPE set to float and then double (in $/source/Noise.h), and post both results, that would be awesome.
Here's both results when run on a RasPi (ARM, stock config):
Code: With NOISE_DATATYPE set to double:
[12:29:16] --- Started Log ---
[12:29:21] cCubicNoise generating 1000 * 256x256 values took 4650000 ticks (4.65 sec)
[12:30:16] cNoise generating 1000 * 256x256 values took 54610000 ticks (54.61 sec)
[12:30:16] New method is 11.74x faster
With NOISE_DATATYPE set to float:
[12:36:52] --- Started Log ---
[12:36:56] cCubicNoise generating 1000 * 256x256 values took 3760000 ticks (3.76 sec)
[12:37:50] cNoise generating 1000 * 256x256 values took 53840000 ticks (53.84 sec)
[12:37:50] New method is 14.32x faster
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
04-18-2013, 04:14 AM
(This post was last modified: 04-18-2013, 04:18 AM by NiLSPACE.)
lol i tried changing it to "int" just for fun ;D its 29.03x faster xD
and bool is 37.11x faster
now trying everything
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
04-18-2013, 05:07 AM
(This post was last modified: 04-18-2013, 05:08 AM by xoft.)
Well, yeah, but the results are wrong. Compare the two .raw files that are in the folder with the program, one is the correct data (old algorithm) and one is the new algorithm, they shouldn't be much different - two or three differences throughout the entire file is more than enough.
(For ints: There are more efficient methods of generating all zeroes)
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
04-22-2013, 05:58 AM
(This post was last modified: 04-22-2013, 06:00 AM by NiLSPACE.)
Is it difficult to change the 2D noise to 3D noise?
EDIT:
Lol i saw here 4D noise ;O what is that lol?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
04-22-2013, 06:01 AM
(This post was last modified: 04-22-2013, 06:35 AM by xoft.)
I changed my mind, I'm not doing the 3D part, I'm actually trying to make MCServer use the faster 2D algorithm wherever it generates 2D noise data. And it's not going so well - so far, the generator is actually slower than before.
Right now, the original version clocked at 190 chunks/sec, while the new version clocks at 145 chunks/sec. No idea why so slow, when the underlying noise generator is faster
Also the terrain looks different, which is weird, they should both generate the exact same thing.
4D noise is usually used when you need to animate a 3D noise, same as 3D noise is used to animate a 2D noise. The noise functions work in any number of dimensions, 6D noise is also quite usual.
Duh, I'm so stupid! In the biomal height gen, I first found out what biomes are used within the current chunk, and then went ahead and generated height for all possible biomes, instead of only the used ones.
Now the performance is back up, but curiously though, not too much higher than before. There's still something fishy. But it'll have to wait till tomorrow.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
I'm having a bad, bad day....
It seems that the new noise is not optimized enough to make up for the need to generate a bit more of it.
I tried replacing cHeiGenBiomal's cubic noise calculation with the new noise generator, but it's about 5 % slower than the original, because the original doesn't compute full noise for all used biomes. So that's a no-go.
Then I tried replacing cCompoGenBiomal's noise (used for underwater sand / dirt decision) with the new noise, turns out that code path is used only 20 % of the time, so making it calculate the full noise array again slowed things down. Another blunder.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
I need testers. I've managed to get 4x4 linear interpolation in Biomal height generator working with reasonable results; however, I need to verify if the results are indeed reasonable. So please get rev 1406, set your height generator to Biomal, and have a look at freshly generated world, if the height seems okay. Especially in the flatter biomes, such as plains or swamps.
You should also see some increase in generator speed, I've measured 22 % more chunks per second.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
well it seems to be allot faster for the generation but the server uses 15-20% CPU for me now and 30% when i started moving to not-generated chunks.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
The main thing is whether the terrain height looks alright. Does it? No regular rectangular shapes?
|