Skip to content

Instantly share code, notes, and snippets.

Last active December 25, 2015 13:58
What would you like to do?
* sigraptr (Mibbit@ has joined #mcmmo
<sigraptr> Why hello there
<Riking> HELLO
<sigraptr> I'm here to share a little info that I have about minecraft.
<sigraptr> Ok, so how, in Minecraft, note that all of the planets are square.
<Riking> this is the mcmmo support channel
* Agge ( has joined #mcmmo
<sigraptr> However, in real life, planets cannot be square as the azimuth, the angle formed betwixt two lines, has to be spherical
<sigraptr> You can find the formula for this by the form, slope 1 times slope 2
<Riking> what planets
<Riking> all i see is the world and a moon
<sigraptr> divided by (1 plus slope 1 times slope 2)
<sigraptr> Wait
<sigraptr> It was slope 2 minus slope 1 for the numerator
<sigraptr> Riking, the moon is infact a planet. Astrophysics has changed its definition to include more orbital bodies.
<Riking> bullshit
<Riking> give me a citation
<Tenebrae> in reality, its just a satellite
<sigraptr> Just as the inclusion of Pluto into the sets of all bodies that are not planets
<Tenebrae> Moon is earth's satellite as Earth is the sun's satellite
<sigraptr> Tenebrae: Ah, a fan of Linneaus, am I right?
<sigraptr> Judging from your name
<Tenebrae> Who's that
<Riking> hey Tenebrae have you seen my tree feller change
<Tenebrae> nope
<sigraptr> Oh, I guess you haven't heard of the biologic book of all organisms
<Riking> I really really like it, I doubled the perf
<Tenebrae> what chant===ged?
<sigraptr> Pythonae
<Riking> (halfved the time)
<Tenebrae> ugh
<sigraptr> Felinae
<sigraptr> Corvidae
<sigraptr> Let me look at that
<Riking> I measured with
<sigraptr> Ew
<Riking> and took that commit out of the PR
<sigraptr> the only thing worse than HashSets
<Tenebrae> Can't read that unfortunaltey xD
<sigraptr> are LinkedHashSets
<sigraptr> one is large in memory
<Riking> code depending on iteration order but heavy in contains() calls
* Agge ( has left #mcmmo (Leaving)
<sigraptr> the other, large in memory and noncontiguous to slow on processing time
<sigraptr> Let me scan this
<sigraptr> I see so many errata
<Riking> I was actually considering not using a LHS, but haven't got around to testing the alternatives
<sigraptr> Riking, Java provides many other data structures
<Riking> s/testing/profiling/
<sigraptr> Given that it is a language full of useless data structures
<sigraptr> Many of which do the same thing
<sigraptr> The exact, same, thing
<Riking> I actually looked up LHS on and it just inherits HashSEt
<Riking> with no extra code
<Riking> sooo
<Riking> lul
<sigraptr> Recursive call for each block
<sigraptr> *Vomits*
<sigraptr> ..
<Riking> The improvement is mostly tightening the search space
<Riking> so that blocks are only inspected once
<sigraptr> So let me guess
<sigraptr> You started with a terrible algorithm
<sigraptr> Decided to minnow it down into a less terrible one
<Riking> yup!
<sigraptr> By reducing the amount of comparisons
<sigraptr> Yet
<sigraptr> You're using recusion
<Riking> and actually increasing the number of blocks inspected
<sigraptr> With Linked Hash Sets
<sigraptr> *recursion
<sigraptr> This is terrible
<sigraptr> Who is in charge here
<sigraptr> You aren't are you?
<Riking> everyone
<sigraptr> Let me try this code
<sigraptr> Give me the git credentials
<Riking> tenebrae, t00thpick, gj, tft
<Tenebrae> hm?
<sigraptr> I'm going to put some better code than this up
<sigraptr> Honestly
<Riking> sigraptr,
<Tenebrae> What, do you actually think I'm in charge ._.
<sigraptr> Someone give me the git info
<sigraptr> Okay.
<Riking> git pull treefeller
<Riking> ^ that contains the profiler
<sigraptr> List<BlockState> treeFellerBlocks = new ArrayList<BlockState>();
<sigraptr> What
<sigraptr> How on Earth
<sigraptr> are you going from a List to an ArrayList
<sigraptr> Why are you even using an ArrayList
<sigraptr> Why
<sigraptr> Why an ArrayList
<Riking> ...?
<sigraptr> 1.
<sigraptr> wait
<sigraptr> Let me see
<sigraptr> Ok I'll let you get away with that
<Riking> rebased in a weird way, try to refresh
<sigraptr> You should really use Lists instead of ArrayLists, kid. This is because ArrayLists are generic upon being generic.
<sigraptr> You can upload objects of any type into your "ArrayList"
<sigraptr> Potentially causing errors
<Riking> uh
<sigraptr> And causing terrible allocations in memory.
<Riking> an arrayList is an implementation of a List
<sigraptr> Did you even go to school for this?
<prplz> top troll 10/10 sigraptr
<sigraptr> I'm laughing right now.
<Riking> the other provided ones are Arrays.asList(), LinkedList, and ImmutableList
<sigraptr> Troll?
<Riking> tell me which one of those is better
<prplz> wat
<prplz> the fuck
<Riking> this is java
<sigraptr> You don't understand what an arraylist is, kiddo.
<Riking> the msdn does not apply here
<sigraptr> You didn't go to school for this, did you.
<prplz> this is java, list is interface
<sigraptr> No, Java was based on C#.
<prplz> ...
<Riking> ......
<sigraptr> It's a derived language of C#.
<sigraptr> That's why the syntax is similar.
<Riking> 1995
<Riking> 2000
<sigraptr> Did you go to school for this? Java was invented by Sun Microsystems.
<sigraptr> No.
<prplz> sigraptr, show me how to use list then
<sigraptr> C# was *released* in 2000.
<prplz> code snippet
<prplz> right now
<sigraptr> Fine.
<Riking> gist, pastebin, hastebin all acceptable
<sigraptr> List<T> list = new List<T>();
<prplz> you are an idiot
<prplz> list is an interface
<Riking> cannot instantiate an interface
<prplz> it has no constructor
<sigraptr> Not List<T> list = new ArrayList<T>();
<prplz> go home
<sigraptr> A list is not an interface, that would imply that it doesn't have a constructor.
<Riking> sigraptr, ^
<sigraptr> Rather, a list is a singleton class.
<prplz> java.util
<prplz> Interface List<E>
<Riking> WHY DOESN'T JAVA ALLOW new List<T>()
<sigraptr> You need to get your degree back from whatever community college you came from.
<sigraptr> Kid.
<prplz> it's an interface.. can you not read?
<prplz> this is java
<sigraptr> No, it's a singleton class.
<sigraptr> There's a difference.
<prplz> read that
<sigraptr> An interface has no constructor.
<prplz> interface
<Riking> the singleton is
<sigraptr> No.
<Riking> and Collections
<sigraptr> Those articles are lies.
<Riking> oops Lists doesn't exist
<sigraptr> MSDN is never incorrect.
<prplz> liek i said, 10/10 troll
<sigraptr> You aren't a programmer are you?
<prplz> im actually mad
<sigraptr> Let me guess, you wanted to make video games.
<sigraptr> So you learned GML
<sigraptr> Then HTML
<sigraptr> then Java
> -> prplz< stop talking
> <- prplz< is he a regular?
> -> prplz< no
> -> prplz< deny an audience
<sigraptr> Clap Clap for you
<sigraptr> The facts stand.
<sigraptr> Do not use an Arraylist for a list.
<sigraptr> Do not use noncontiguous datatypes in memory
<sigraptr> Even if you need something to resize
<sigraptr> You are a very naïve programmer, kiddo, you have a lot to learn.
<sigraptr> (I'm serious though, I might push code to the gitaccount, and it'll be O(n) orders of magnitude better than whats already there0
<sigraptr> *)
<Riking> you may only push to your own fork, that's the idea of forking and pull requests
<sigraptr> No, that's not how TurtleSVN works
<sigraptr> Oh my gosh here we go
<Riking> The project is hosted on GitHub, not TurtleSVN. While that may be true for SVN, git has awesome branching and you don't need to put everything on master.
<sigraptr> GitHub is for college students though
<sigraptr> Not respectable projects
<sigraptr> Ok, this project needs some organization.
<sigraptr> I'm sorry
<Riking> I may try to reinvent the algorithm to not use recursion, however I will be comparing it to this current implementation and if it's not up to snuff quickly I will abandon it.
<Riking> You are free to attempt to make a better-performing version on your own time.
<sigraptr> Have fun drowning in near stack overflows, kiddo.
<prplz> you can't stack overflow in java
<sigraptr> Hint: use iterations
<Riking> yes you can
<prplz> it's impossible
<Riking> prplz, you can
<prplz> no you can't
<prplz> look, my C# docs say so:
<sigraptr> You can stack overflow in Java, because it is similar to C#.
<Riking> however, this implementation only recurses once for each log in the trunk
<sigraptr> See?
<Riking> not once for every leaf
<sigraptr> Oh that's GREAT
<sigraptr> It doesn't matter that its slow
<sigraptr> Because there isn't much to count
<sigraptr> w00t
<sigraptr> Programmer Nobel Peace Prize
<Riking> Do you want my timings on it?
<sigraptr> You have just effectively solved P=NP
<Riking> Pre-JIT: 20:06:18 [INFO] [mcMMO] [Debug] Tree feller processing took -58.956327 milliseconds.
<sigraptr> congrats
<Riking> JIT part 1: 20:08:29 [INFO] [mcMMO] [Debug] Tree feller processing took -72.101279 milliseconds.
<Riking> JIT part 2: 20:09:33 [INFO] [mcMMO] [Debug] Tree feller processing took -28.982204 milliseconds.
<Riking> Post-JIT: 20:11:42 [INFO] [mcMMO] [Debug] Tree feller processing took -12.386691 milliseconds.
<sigraptr> 58ms
<sigraptr> 72ms
<Riking> those are all Jungle Trees
<sigraptr> This is for each tree I assume
<Riking> 7 minutes later, another: 20:16:11 [INFO] [mcMMO] [Debug] Tree feller processing took -11.231904 milliseconds.
<Riking> yes, and I put the subtraction backwards and did not bother to fix it
<sigraptr> Yeah
<Riking> Before this change, they were about 30ms post-JIT
<sigraptr> I figured that you weren't traveling back in time
<sigraptr> ms add up
<sigraptr> But
<Riking> more than you probably realize
<sigraptr> It could be, hmph, optimized
<Riking> we've only got 50ms in a tick
<Riking> so this is still a LOT of the allotment
<sigraptr> What
<sigraptr> Oh right, servers and whatnot
<Riking> 50 * 20 = 10 00
<sigraptr> 1000 ms is 1 second
<sigraptr> Oh
<Riking> yeah, 50ms for EVERYTHING
<sigraptr> Why do you use Linked Hash Sets?
<sigraptr> Why use Linked anything?
* psgs|away is now known as psgs
<sigraptr> Why use Hash Sets
<Riking> Hashsets - because fast contains()
<prplz> what sets do you recommend sigraptr ?
<Riking> and BlockState provides a correct implementation
<Riking> actually, I should probably swap the BlockStore check to second
<Riking> PlaceStore rather
<sigraptr> HashSets are fast
<sigraptr> But you could consider writing a native low level data structure in C++ and having a second async program handle the set values?
<Riking> hell no I ain't messing with no JNI
<sigraptr> And stream updates to and fro the secondary thread
<Riking> also the bukkit API craps in your face when you do async
<sigraptr> thread>>process
<sigraptr> Ok I give up
<sigraptr> Every fucking thing I say to try and troll you
<sigraptr> You just brush it off
<sigraptr> Are you on antidepressants
<Riking> t00thpick1, recommending for permaban^
<sigraptr> What is up with you
<prplz> sigraptr, 10/10 you're great
<sigraptr> aw shucks
<prplz> new List()
<prplz> :D
<sigraptr> ahaha
<sigraptr> Lists aren't generic
<sigraptr> Oop am I trolling
<sigraptr> ?
<sigraptr> Riking: a good alternative
<sigraptr> If you want my honest opinion
<Riking> I should probably delete BlockUtils.affectedByTreeFeller if it isn't used
<Riking> done
<sigraptr> Is to not try and create fast non serializable data structures on a bloated platform that compiles to tertiary bytecode running atop other bytecode in a virtual machine that async handles many applications at once, some of which legitimate applicatinos and the other just happening to be exploits, viruses, and the other variety of spyware that javaw.exe goates
<sigraptr> onto your HDD
<sigraptr> ie: write this in Ruby on Rails
<Riking> we're not serializing this, I took care of all that stuff last month
<Riking> :D
<sigraptr> *goatses
<Riking> well except for the scoreboard doing database access on the main thread, but I fixed that too
<Riking> just isn't in master yet
<sigraptr> I'm done.
<sigraptr> Urk
* sigraptr (Mibbit@ has left #mcmmo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment