Inefficent Bugs



  • Code

    That line will cause any block that has 'ore' anywhere in its name to show up when the block is used. Also, the onBlockPlaced is called each time an instance of the block is placed, and the 'coder' loops over the block registry EACH FUCKING TIME! In a big pack, that would cause a major lag spike.

    This was found by someone on a Minecraft Discord channel, when Ore Crushers popped up when that block was placed (said block creates random ores in a 3 x 3 x 3 cube around it from what I can tell from the code).

    @RaceProUK Could I borrow a :piko: ? I think that developer needs a solid whack.



  • @brisingraerowing What I'm more worried about is that the Bukkit coders, having read a Patterns and Practices book with their brains turned off, changed all function calls that take an {X, Y, Z, Dim} position as separate parameters into one that takes an "immutable" Position javabean object with X, Y, Z, and Dim properties accessors. Good that they've reduced the parameter count, but rules-as-written Java doesn't support new value types, so rather than efficiently passing 7 bytes on the stack they're passing an 8-byte pointer to a 7-byte-plus-overhead object that needs lifecycle management and which thousands of are created per frame. That's been causing far more lag spikes since 1.8 came out.

    But yeah, the first half of that code should run once during the PostInitialize stage in Forge booting, not "every time someone plops a block".


  • Fake News

    Inefficient Bugs

    *Twitch*



  • @jbert said in Inefficent Bugs:

    Twtch

    FTFY.


  • Considered Harmful

    @twelvebaud Bukkit coders? Try regular old Minecraft and BlockPos. This is why Sponge's recommended Java settings include setting the collector to G1.



  • @jbert said in Inefficent Bugs:

    Inefficient Bugs

    *Twitch*

    Yes, I imagine that Twitch is full of inefficent bugs. :trollface:

    Filed Under: And brillant hax. I expect that Paula Bean help with those.



  • @pie_flavor That's actually exactly what I was referring to. Minecraft was good (well, less bad anyway) until those morons took charge.



  • @twelvebaud Yeah, the lack of either user-defined value types (like C#structs) or compiler reference->value resolution for PODs is deadly in Java. I have to admit that C# came through on that one.

    I still see using a resolution mechanism (with hinting/forcing pragmas) as preferable, even though I really don't see a way that it could be done with Java's classes-only type model for user-defined types.



  • @jbert



  • @brisingraerowing said in Inefficent Bugs:

    @jbert

    I suspect that you are :whoosh: ing on the spellar error @JBert is bitchCOMPLAINing about.


  • Considered Harmful

    @twelvebaud No, BlockPos has always been there.



  • @pie_flavor I am guessing that @TwelveBaud's issue is not with the existence of the BlockPos class, or even with the use of BlockPosobjects, but rather,

    • that using them as parameters for methods which get frequently called interacts badly with how Java passes reference arguments due to the lack of value-typed user-defined PODs;
    • that the problem is one well-known to competent Java coders, and that passing the individual data points, while a kludge, is an established work-around when passing POD data structures; and,
    • that they removed or at least deprecated the already existing methods which applied that work-around, rather than overloading them.

    At least, this is my reading of @TwelveBaud's comments.



  • @scholrlea I should add (in a separate post, since this is a bit of an aside) that my own view of this is that this is a sign of a bigger problem, not just with Java but with several other languages as well, which is that there's not enough separation of policy and implementation, something which is it really at the heart of OOP but which many current OOP languages eschew in the language designs themselves.

    Basically, the problem is that Java define reference parameters in terms of the how it works (implementation), rather than what it does (semantics). In Java, any non-primitive is always passed by reference, even when they could be passed by value without changing the semantics. The compiler, and to some extent the JVM, lacks the flexibility to exploit such circumstances.

    Implementing it would increase the overhead for both compilation time and classfile size, but would allow a number of improvements in performance.

    This is just one place where this kind of problem arises, and as I said, similar problems appear in C# and other languages as well. C# avoids this particular issue, but at the cost of adding a separate category of value-typed structs that need to explicitly managed differently from objects.


  • Considered Harmful

    @scholrlea said in Inefficent Bugs:

    @pie_flavor I am guessing that @TwelveBaud's issue is not with the existence of the BlockPos class, or even with the use of BlockPosobjects, but rather,

    • that using them as parameters for methods which get frequently called interacts badly with how Java passes reference arguments due to the lack of value-typed user-defined PODs;
    • that the problem is one well-known to competent Java coders, and that passing the individual data points, while a kludge, is an established work-around when passing POD data structures; and,
    • that they removed or at least deprecated the already existing methods which applied that work-around, rather than overloading them.

    At least, this is my reading of @TwelveBaud's comments.

    Right; I'm just saying that it's always been there, whereas @TwelveBaud was saying Microsoft fucked it up.



  • @pie_flavor I am pretty sure that @TwelveBaud was talking about Bukkit, not about what Microsoft has done with Minecraft since purchasing it.

    My knowledge of Minecraft couldn't fill a thimble, but I do seem to recall coming across some information when I was looking things up about Sponge and Skript to help 86'ed (which I am still doing, BTW). Correct me if I am wrong on these two points:

    • Wasn't Bukkit introduced by a fan (not Notch or anyone else working on the game itself), and got started before Microsoft purchased Mojang?

    • Isn't Bukkit discontinued (or at least no longer supported by the guy who initially developed it)?

    Did I misunderstand this?


  • Considered Harmful

    @scholrlea said in Inefficent Bugs:

    Did I misunderstand this?

    Yes.

    @scholrlea said in Inefficent Bugs:

    not about what Microsoft has done with Minecraft since purchasing it.

    @twelvebaud said in Inefficent Bugs:

    @pie_flavor That's actually exactly what I was referring to. Minecraft was good (well, less bad anyway) until those morons took charge.

    I assume 'those morons' refers to Microsoft.

    Otherwise, your two facts are correct; Minecraft was purchased soon after the 1.7 update, whereas Bukkit was created way the hell back in Beta after hMod died. And Bukkit died after it was DMCA'd very close to when Microsoft bought Mojang.


  • Notification Spam Recipient

    Speaking of inefficient bugs:

                logsVisible: function () {
                    return this.logs[this.logSelected].entries.filter(function (item) {
                        return this.logVerbositySelected.length == 0 || this.logVerbositySelected.filter(function (vb) { return vb ==this ;},item.Verbosity).length > 0;
                    }, this);
                },
    
    

    This stupid thing I wrote is godawful and bloats Chrome's memory usage by over 15x (and probably more with a longer-running log). I'm half tempted to post in Coding Help for optimization tips...


  • Considered Harmful

    @tsaukpaetra said in Inefficent Bugs:

    optimization tips...

    I found your problem - you're using Javascript.


  • Notification Spam Recipient

    @pie_flavor said in Inefficent Bugs:

    @tsaukpaetra said in Inefficent Bugs:

    optimization tips...

    I found your problem - you're using Javascript.

    Provide a better web-based programming language that's widely supported by major browsers for the convenience of an install-less experience and I'd be overjoyedsurreptitiously interested to switch.


  • Considered Harmful

    @tsaukpaetra Rust, with the wasm32-unknown-emscripten target.


  • Notification Spam Recipient

    @pie_flavor said in Inefficent Bugs:

    @tsaukpaetra Rust, with the wasm32-unknown-emscripten target.

    I don't understand, isn't that just compiled javascript, more or less?


  • Considered Harmful

    @tsaukpaetra No, it's compiled Rust, in WebASM format. As in, tens of times faster than JS and does not suffer from silly allocation issues like that one.


  • Discourse touched me in a no-no place

    @scholrlea said in Inefficent Bugs:

    I still see using a resolution mechanism (with hinting/forcing pragmas) as preferable, even though I really don't see a way that it could be done with Java's classes-only type model for user-defined types.

    I think it's something one would need to do in the JIT level, probably as a second-stage optimisation while you're already running the code. Essentially the JITter need to examine whether the lifetime of an object can be statically determined to be tied to a particular stack frame (it's not that hard to do with SSA and function method inlining) and if so, alter its allocation management strategy to be stack based. The good part is that at the JIT level you really do have all the information you need in order to do this, and you shouldn't need any explicit hinting (which is good, because people get that stuff wrong).



  • @pie_flavor @ScholRLEA Sorry for the confusion. "Those morons" refer to the developers of Bukkit, who were hired en masse by Mojang after Notch left but before the Microsoft buyout. They continue to fuck up work on the Java app, while 4J and other actually competent Microsoft studios work on the other editions.


  • Considered Harmful

    @twelvebaud said in Inefficent Bugs:

    @pie_flavor @ScholRLEA Sorry for the confusion. "Those morons" refer to the developers of Bukkit, who were hired en masse by Mojang after Notch left but before the Microsoft buyout. They continue to fuck up work on the Java app, while 4J and other actually competent Microsoft studios work on the other editions.

    That's an... interesting perspective. Could you elaborate? The Bukkit team has been with Mojang almost since Minecraft 1.0. How have they been fucking it up? IMO Dinnerbone makes the greatest parts of the game. And you have your facts wrong. Bukkit was hired in 2012; Notch left in 2014 after selling it.


Log in to reply