mc java edition is now written in java, but c++ is way faster. I know bedrock is written in c++ but nobody like bedrock. But its a fact that bedrock runs faster than java with the same settings, thats because bedrock is written in c++ and java in java. So what if we add a mc java edition version in c++ so people have better performance? Im not sure if this will work but maybe you can use a compiler to convert the java edition source code to c++. The only down side is that almost all mods, datapacks, plugins and clients are made for java edition so I thought about something. What if they keep java edition and add another java edition but written in c++? Than all mods, client, datapack, and plugin developers can slowly make their mods compatible for the java edition in c++.
The bad performance of Java has nothing to do with the language:
Can Bedrock run at 478 FPS at 32 chunk render distance on a 10 year old CPU from a time when AMD CPUs were considerably inferior to Intel? What about 256 chunk render distance?
In my own tests FC2 could easily outperform everything else, including the W10 edition (MCPE/Bedrock).
The config allows increasing the view distance limit up to 256 [they do not say but this clearly means chunks as 256 blocks is only 16 chunks, which is not even the maximum in vanilla]. Performance will likely tank once the game runs out of VRAM.
All rendering happens with full detail and for a view distance setting of d FC2 will render (d*2+1)2 chunks, some bugs around post-initial area and very large distances aside. The whole view distance is being simulated (ticked). MCPE doesn't do either.
The main reason by far why Java runs so badly is because the developers at Mojang have no idea how to write optimized code. Part of this is caused by the fact that Java relies on a garbage collector but the rate of object allocation is all down to how Mojang has coded newer versions, which can allocate hundreds of megabytes per second (this refers to 1.8 but it has only worsened since then):
Minecraft 1.8 has so many performance problems that I just don't know where to start with. Maybe the biggest and the ugliest problem is the memory allocation. Currently the game allocates (and throws away immediately) 50 MB/sec when standing still and up to 200 MB/sec when moving. That is just crazy...
...tldr; When 1.8 is lagging and stuttering the garbage collector is working like crazy and is doing work which has nothing to do with the game itself (rendering, running the internal server, loading chunks, etc). Instead it is constantly cleaning the mess behind the code which thinks that memory allocation is "cheap".
For comparison, my own modded version based on 1.6.4 only allocates about 1 MB per second when not loading new chunks, which is very easy to manage when combined with a very low baseline memory usage:
Likewise, there is absolutely no excuse for this; they didn't even change biome generation that much in 1.13, aside from splitting oceans into separate biomes, which should of had no noticeable impact, yet somehow it became 35 times slower - and even then my own biome generator is much faster than 1.12 despite having more biomes with much more complex biome placements (while I do not know the system specs of the person who posted the following I can generate a similarly sized biome map in about 200 ms, making it nearly 5 times faster than 18w05a, which I assume reflects 1.12; even if Mojang later optimized it it is unlikely to have returned to older speeds given that I still see comments to use AMIDST on 1.12 if you want faster results. This is also true of many other times when Mojang claims to have "optimized" something - two steps back, one step forward):
Of course, even some of the JVM's own code isn't that good; for example, its "Random" class is simply terrible and by just replacing it with a functionally identical replica I was able to halve the time taken by cave generation, plus make full use of a 64 bit seed (Random is so poor because it was designed to be used by multiple threads but virtually every use by the game doesn't need it, and this means that every time it is accessed a reference to main memory is needed and accessing system RAM is very slow):
Random.nextInt(n) took 9.9637 nanoseconds
Random64.nextInt(n) took 1.2762 nanoseconds; was 7.8073187 times faster than Random
Random.nextFloat() took 9.9535 nanoseconds
Random64.nextFloat() took 1.2763 nanoseconds; was 7.798715 times faster than Random
Random.nextGaussian() took 71.8699 nanoseconds
Random64.nextGaussian() took 5.033 nanoseconds; was 14.27973 times faster than Random
I can't even find any sources for a faster C++ RNG (the fastest of many listed here is 4 ns, or 3 times slower, and only half of that can be explained by differences in CPU performance), which should not be surprising since the JVM compiles bytecode into native assembly - only if you are running a JVM from the 1990s would it be entirely interpreted. Other than that, Java's default math functions (e.g. sine) are slow because they must give the exact same results on any system but this can be circumvented by using your own substitutes, as Minecraft does (Optifine has a "fast math" setting which uses more optimized functions, and I've implemented my own; all of these trade accuracy for speed but accuracy is not important for how the game uses them, e.g. entity rotation or the direction cave tunnels go in).
Also, it should be noted that this suggestion has been posted many times recently - you should check if there are recent threads before making another one:
but its true that c++ programs run faster than java programs right?
btw how do you implement more optimized functions into optifine???
thx for the explainin, ur doeing a great job
Even if the theoretical performance of C++ is higher the majority of why the game runs poorly is down to the way it was coded, and even Bedrock has its own performance issues:
As for Optifine, I mentioned that it had a "fast math" setting to speed up calculations to get around Java's own math functions being slow due to being designed to give precise, consistent results on every platform supported by Java (you can run a Java program on any CPU/OS as long as there is a JVM built for it, hence why there is only one version of Java Edition for Windows, Mac, and Linux, two of which aren't even supported by Bedrock, or anything older than Windows 10, and as a result different CPUs and native OS libraries can give different results, but this usually does not matter for a game, even rough approximations are usually good enough), not how to add them, and in any case you'd need modding experience in order to do it yourself.
mc java edition is now written in java, but c++ is way faster. I know bedrock is written in c++ but nobody like bedrock. But its a fact that bedrock runs faster than java with the same settings, thats because bedrock is written in c++ and java in java. So what if we add a mc java edition version in c++ so people have better performance? Im not sure if this will work but maybe you can use a compiler to convert the java edition source code to c++. The only down side is that almost all mods, datapacks, plugins and clients are made for java edition so I thought about something. What if they keep java edition and add another java edition but written in c++? Than all mods, client, datapack, and plugin developers can slowly make their mods compatible for the java edition in c++.
What do you guys think?? let me know??
There have been many versions of the game not just bedrock edition
there's also console editions, including 3DS edition.
but those ones have small or limited world sizes as well as tiny render distances,
not to mention they don't have all of the updates the current versions have,
and as a result, for some people are much less fun to play in.
I can't help but wonder if it is even worth Mojang trying to recompile Java edition to C++ at this point,
why not just make bedrock edition have all the vanilla features Java edition has and fix the bugs to do with redstone and world generation?
bedrock edition has most of the features already, including the Nether update and Caves and Cliffs part 1,
they have what they need to make an ultimate edition of the game at least on paper.
mc java edition is now written in java, but c++ is way faster. I know bedrock is written in c++ but nobody like bedrock. But its a fact that bedrock runs faster than java with the same settings, thats because bedrock is written in c++ and java in java. So what if we add a mc java edition version in c++ so people have better performance? Im not sure if this will work but maybe you can use a compiler to convert the java edition source code to c++. The only down side is that almost all mods, datapacks, plugins and clients are made for java edition so I thought about something. What if they keep java edition and add another java edition but written in c++? Than all mods, client, datapack, and plugin developers can slowly make their mods compatible for the java edition in c++.
What do you guys think?? let me know??
The bad performance of Java has nothing to do with the language:
Can Bedrock run at 478 FPS at 32 chunk render distance on a 10 year old CPU from a time when AMD CPUs were considerably inferior to Intel? What about 256 chunk render distance?
The main reason by far why Java runs so badly is because the developers at Mojang have no idea how to write optimized code. Part of this is caused by the fact that Java relies on a garbage collector but the rate of object allocation is all down to how Mojang has coded newer versions, which can allocate hundreds of megabytes per second (this refers to 1.8 but it has only worsened since then):
For comparison, my own modded version based on 1.6.4 only allocates about 1 MB per second when not loading new chunks, which is very easy to manage when combined with a very low baseline memory usage:
Likewise, there is absolutely no excuse for this; they didn't even change biome generation that much in 1.13, aside from splitting oceans into separate biomes, which should of had no noticeable impact, yet somehow it became 35 times slower - and even then my own biome generator is much faster than 1.12 despite having more biomes with much more complex biome placements (while I do not know the system specs of the person who posted the following I can generate a similarly sized biome map in about 200 ms, making it nearly 5 times faster than 18w05a, which I assume reflects 1.12; even if Mojang later optimized it it is unlikely to have returned to older speeds given that I still see comments to use AMIDST on 1.12 if you want faster results. This is also true of many other times when Mojang claims to have "optimized" something - two steps back, one step forward):
https://github.com/toolbox4minecraft/amidst/issues/395#issuecomment-386838958
Of course, even some of the JVM's own code isn't that good; for example, its "Random" class is simply terrible and by just replacing it with a functionally identical replica I was able to halve the time taken by cave generation, plus make full use of a 64 bit seed (Random is so poor because it was designed to be used by multiple threads but virtually every use by the game doesn't need it, and this means that every time it is accessed a reference to main memory is needed and accessing system RAM is very slow):
I can't even find any sources for a faster C++ RNG (the fastest of many listed here is 4 ns, or 3 times slower, and only half of that can be explained by differences in CPU performance), which should not be surprising since the JVM compiles bytecode into native assembly - only if you are running a JVM from the 1990s would it be entirely interpreted. Other than that, Java's default math functions (e.g. sine) are slow because they must give the exact same results on any system but this can be circumvented by using your own substitutes, as Minecraft does (Optifine has a "fast math" setting which uses more optimized functions, and I've implemented my own; all of these trade accuracy for speed but accuracy is not important for how the game uses them, e.g. entity rotation or the direction cave tunnels go in).
Also, it should be noted that this suggestion has been posted many times recently - you should check if there are recent threads before making another one:
https://www.minecraftforum.net/forums/minecraft-java-edition/suggestions/3095585-javarock-edition
https://www.minecraftforum.net/forums/minecraft-java-edition/suggestions/3101158-some-improvements-java-needs
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
but its true that c++ programs run faster than java programs right?
btw how do you implement more optimized functions into optifine???
thx for the explainin, ur doeing a great job
Even if the theoretical performance of C++ is higher the majority of why the game runs poorly is down to the way it was coded, and even Bedrock has its own performance issues:
MCPE-74696 The Nether Update brings unbelievable lag
As for Optifine, I mentioned that it had a "fast math" setting to speed up calculations to get around Java's own math functions being slow due to being designed to give precise, consistent results on every platform supported by Java (you can run a Java program on any CPU/OS as long as there is a JVM built for it, hence why there is only one version of Java Edition for Windows, Mac, and Linux, two of which aren't even supported by Bedrock, or anything older than Windows 10, and as a result different CPUs and native OS libraries can give different results, but this usually does not matter for a game, even rough approximations are usually good enough), not how to add them, and in any case you'd need modding experience in order to do it yourself.
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
There have been many versions of the game not just bedrock edition
there's also console editions, including 3DS edition.
but those ones have small or limited world sizes as well as tiny render distances,
not to mention they don't have all of the updates the current versions have,
and as a result, for some people are much less fun to play in.
I can't help but wonder if it is even worth Mojang trying to recompile Java edition to C++ at this point,
why not just make bedrock edition have all the vanilla features Java edition has and fix the bugs to do with redstone and world generation?
bedrock edition has most of the features already, including the Nether update and Caves and Cliffs part 1,
they have what they need to make an ultimate edition of the game at least on paper.
yeah that would be great