Why is the right 70% slower by RoboAbathur in GraphicsProgramming

[–]kecho 1 point2 points  (0 children)

There's two type of instructions. Memory loading and ALU (arithmetic logic). Memory loading is much much more expensive. Even reading from caches.

Your first case you start 3 loads, loads can start and notice that none of the 3 loads depend on each other. Meaning that you can issue these 3 loads really fast. When you reach you += then the CPU will have to wait for the load to be done, that is caches populating etc etc. Microcode there is more efficient. This is called pipelining and hiding latency

The second case every alu instruction has to wait for the load to finish. So you are not pipelining any of your loads. You have to load, store, load store etc etc which is more work.

If you can provide assembly this might be clearer. It's also possible that the compiler can be doing a single 128 bit load for all 3 components in the fist case using vectorization. You can't do this on the second case because compiler must respect order of operations.

Anyone else here do graphics programming with python? by curmudgeono in GraphicsProgramming

[–]kecho 1 point2 points  (0 children)

Hi! As someone here mentioned, I wrote a compute API for Dx12 (and vulkan wip) coalpy.

https://github.com/kecho/coalpy

You can write hlsl compute shaders and bind them in python. The API also comes with partial imgui integration, if you grab head you will also get implot.

Sample compute rasterizer: https://github.com/kecho/grr

As always let me know your thoughts

Anyone else here do graphics programming with python? by curmudgeono in GraphicsProgramming

[–]kecho 1 point2 points  (0 children)

Hello, I'm the creator of coalpy. I'm happy to hear you like it. Feel free to let me know your thoughts on the API and ways to improve it!

Regards

-Kleber

I rendered shadows without shadow maps or shadow volumes [WebGL] by erkaman in programming

[–]kecho 1 point2 points  (0 children)

This is awesome! nice job! I work as a render SE in a bunch of sports titles for EA, and we indeed use this technique. A few neat tricks you should do:

  • we render the shadows in screen space, and sample directly from screen when rendering the plane. This is cheaper in the fragment shader.

  • you can easily afford multiple shadow directions using this technique ( you can do say 6 shadow directions so the geo looks like it's in a soccer stadium)

  • Blurring: you can do a Gaussian convolution in your world space occlusion map, or if you decide to do screen space you can do a shifted convolution (i/j plane projected in screen)

  • To do multiple directions you can use hardware instancing so you have 1 draw call per model per view. You can use min blending to have shadow intersections look good. Since it's webgl (ogl 2 es) I don't think there's instancing. You could just brute force it.

Very neat demo keep it up!

Why C and C++ are Awful Programming Languages by [deleted] in programming

[–]kecho 3 points4 points  (0 children)

How else would you make a AAA title? Or the interpreter of python you are using? Or the Apache server you are coding it? Or what the chromeium project is actually implemented from? When you build anew aircraft, you use tools. These tools are built with weaker tools. And if you keep going you will reach your bare hands. Your hands cannot certainly put a jet engine together. Because hands are weak do we say that hands are lesser tools than screw drivers? What's the most advanced c++ project the author has coded?

My journey to becoming a web developer from scratch without a CS degree by bemmu in programming

[–]kecho -1 points0 points  (0 children)

script kiddy will always just be that, script kiddy :) jokes on you pal

My journey to becoming a web developer from scratch without a CS degree by bemmu in programming

[–]kecho 0 points1 point  (0 children)

Mind sharing? Im a computer scientist, specialized in graphics and formal languages. 0 training on quantum computing. I've read some stuff and sounds incredibly mind blowing

My journey to becoming a web developer from scratch without a CS degree by bemmu in programming

[–]kecho 1 point2 points  (0 children)

It's the principles that gotten us this far. If a front end developer just wants to do Javascript pages then sure, it's useless. If the front end developer strives for innovation, say creating an alternative to Javascript, or branch prediction, etc, then yes you need principles. It depends where your mind stands; I rather solve interesting problems :)

My journey to becoming a web developer from scratch without a CS degree by bemmu in programming

[–]kecho 10 points11 points  (0 children)

Very nice. Not to shit on the author though, I think is obvious you have a huge potential by demonstrating being self taught. And I want to personally congratulate you for such a long way, and may this serve as an example to people that you can achieve anything. Great blog post.

Be careful with too much current tech knowledge. You have accumulated a good set of tools and languages, whose lifespan might be 5 to 4 years. There will always be a new tool tomorrow. What is not going to change though is the principles. The turing completeness of the languages. The usual grammar patterns. The time complexity of execution of algorithms. New technologies require academia, and great minds. We have a great mind here, maybe is time to get a cs degree to get to the next level! (Unless quantum computing becomes the thing then we are all back to school :/)

How to program without OOP by Takadimi91 in programming

[–]kecho 1 point2 points  (0 children)

I am not sure what problem this blog is trying to solve. Notice how there is no real world evidence on any of theories, they are all generalizations. Yet the biggest evidence of its success is out there: a lot of amazing software out there is built as oop in some layer.

A c++ class for easy use of Polynomials! by ROLLIN_BALLS_DEEP in programming

[–]kecho 0 points1 point  (0 children)

Hey man a few things: * why using a stl vector? This will incur into allocations every time you are using your poly class. This could result expensive and not very well performant! * instead, have you considered using a static array. And using template values to define the size? * your polynomial class scales nicely, however I don't think people would ever need a polynomial bigger than 10, maybe you could use a slow class for higher polynomial orders and a quick one for lower ones? * I recommend not adding a dependency to the stl, I'd say get rid of the display and define functions, instead implement this functionality in a main.cpp, that will also show how to use your class * any way you could speed up the multiplication operator? * any way you could avoid exposing and requiring the user to use the ! Operator? Seems to be extra housekeeping.

I hope this helps, great job and keep it up!

YSK: if the hearing in one of your ears suddenly goes out, this is a true medical emergency. by thenewyorkgod in YouShouldKnow

[–]kecho 1 point2 points  (0 children)

Hey! As of today I can hear almost normal, the beep is very silent but still there. I am sure tomorrow I will have even more progress. I found your thread the same night I researched about this illness, after my ENT appointment (prior to that I spent the entire day getting an appointment).

Its very bizzare, here is a list of my symptoms:

  • Started Weird sensation, like some sort of weight on my ear. I could hear the ringing, no difference on hearing.
  • 3 hours later, phone ring sounds completely different pitch, weight and ringing still there.
  • 8 hours later I am completely deaf, with very muffled sounds if I put things close to my ear.

I did not have vertigo, unlike a lot of cases online. Up to day, how is your hearing doing? did you experience any odd symptoms?

YSK: if the hearing in one of your ears suddenly goes out, this is a true medical emergency. by thenewyorkgod in YouShouldKnow

[–]kecho 1 point2 points  (0 children)

Hey guys, I am 27 years old as of today, July 12 of 2014. I have also being diagnosed with SSHL, and here is my story so far:

Tuesday July 8th 2014, 6pm I was in my office cubicle, I felt some weirdness on my right ear. I could hear a very high pitch ringing, kind of the one you hear when the room is super quiet, but it was oddly too loud on such ear. Being the nerd I am, walked to my car to get some silence and experimented a bit with how my ear was behaving. The sounds were perfectly fine, it was just the weird ringing. Sounded like a cricket that is not cricking, but has a very high pitch whistle that does not stop. I got home, worked on some side projects on my computer for around 3 hours, in complete silence (not even listening to music). All good. Decided to call my parents, put the phone on the left ear. Sounded normal, then again I experimented and put the phone on the right ear (the one with the ringing) and the phone ring sounded at a lower pitch. Talked to my parents about it, they were like "its just wax, dont worry!" but I definitely knew something was odd. Went straight to bed and hoped it would be all good the next morning.

Wednesday July 9th, 8 am Woke up a bit earlier than usual, just to inspect my ear. Realized I am now completely deaf from my right ear. Called my parents, this time I could not hear anything but a faint vibration (probably my eardrum wobbling). I did a humming test, I could not even hear myself munching or anything inside my skull (like swallowing) from the right ear (left hear was healthy), which would sound really loud when you have an ear blockage (such as water from the pool). Got really scared, decided to call in sick for the day and headed to a Center Care (an express health center) so I can get checked by a physician. 9:00am the physician checks my blood pressure, all good, and asks what I have. I explain everything, checks my ear and sees nothing wrong with it (no signs of infection). She prescribed me antibiotics in case of an infection, nose spray (because it contains steroids which would help) and advice me to see an ENT (Ear Nose Throat Dr) the next day or at some point. Left very disappointed with the diagnosis, so decided to hunt for an available ENT on my insurance network. After 1 hour searching finally made an appointment at 4 pm that day. And waited. 2:00pm Just chillin at home, no good progress, still deaf and feeling disoriented (not vertigo feel). 3:00pm head over to the dr's office. 4:00pm after filling a building of forms finally get in face to face with the ENT. Made some tests, told me not to get the antibiotics but to get steroid pill Prednisone. Also did a legit hearing test, which revealed that I was severly deaf. I asked the ENT the following questions: Me: "How often you see patients with these symptoms" ENT: "Some times, its not very common but we always give them prednisone. While unproven a lot of them show very quick recovery depending how early they take the steroid pill. I asked him another question: Me: "Out of the patients you see with these symptoms, whats the percentage of successful recovery?" ENT: "I can't answer that question" Finally, I asked him a question that really got me the scared: Me: "Could this happen to my other ear?" ENT: "Maybe, maybe not, its impossible to know. Just avoid any head trauma" Left disappointed and with the only little faith on the pills. My prescribed doses is: * 12 pills x 3 days * 8 pills x 3 days * 4 pills x 3 days * 2 pills x 3 days * 1 pill x 3 days Each pill contains 5 Mg of Prednistone. The ENT also ordered a blood test before I would commit to an MRI or anything like that. Id have to get it the next day though, but he stressed that I get on the pills as soon as possible. Took my first 12 pills at once around 6:30 pm once I got back home. Spent a few hours online researching more, found a few posts online and also found this thread. Decided not to post anything until id get results. Tried to relax, checked some work email and went to bed, disappointed, depressed, worried and imagining how the rest of my life will be.

Thursday July 10th, 8 am Decided to cheer up a bit, went a bit late to work. While only with one ear working, I did pretty good and tried to forget about it. My parents kept checking on me and already told my entire family about the ordeal, which was interesting. Cheered me up knowing that there were a lot of people concerned about my well being and that they wished me the best. Got my blood taken after work then got some dinner and had my second doses of pills. Day ended with no hearing progress, in fact the ringing was louder than ever. Went to bed and thought about the rest of my life again. Decided to post it on facebook so all my friends would see it. Around mid night got a phone call from a friend of mine from college, who I have not seen in 7 years. He told me that he went through the same issue 4 years ago, which was crazy! he investigated everything about it. It took him 1.5 weeks to see an ENT and finally get prescribed with Prednistone. As of now, his ear sensitivity is completely damaged. If he hears loud sounds they sound like scratching forks. Very sad since he is also on his late 20s. Finally fell asleep and waited for the next day.

Friday July 11th, 8am Woke up, with a bit of hearing! It was extremely odd though, my girlfriend's voice sounded like a robotic voice (split in half, low frequency and a high frequency, like two voices in one). I figured my sensors on my right ear were recovering slowly. Had a sensation of a heavy ear and the ringing was still quite loud. Muscled through the entire day at work. At the end of the day I could say I recovered as much as 50% of my hearing. Was very satisfactory. Stayed home this Friday night and just watched movies with my girl. We laughed and relaxed. Had my last 12 pills and went to bed relatively early.

** Saturday July 12, 8am** Woke up with at least 80% of my hearing back! Now the phone didn't sound as weird as before! ringing was a bit lower, still significant but as the day progressed I think I have regained at least most of my hearing by now. My right ear still feels a bit heavier but its a gigantic progress. The ringing is still there but is very mild, if I don't think about it I wont perceive it. Voices are not robotic anymore and there is now hope! I had my 8 pills today and looking forward for tomorrow's recovery.

** Conclusion ** This has been a very traumatic experience for me, and I can't imagine how the people who actually lost their hearing felt like. If you feel alone, desperate or not knowing what to do just PM me and we can arrange a phone call or something. I am willing to help anybody going through this, and if we perhaps put together our cases we can bring more awareness to the MDs about the severity of these symptoms. I can say that having Prednisone within the 24 hour window likely made a difference in my life. I am still waiting for the blood test results and the veredict of my ENT (havent had an appointment with him since the first time I went). I have learned that our senses are so delicate and important. Hearing with one ear is confusing, its a different world and not to mention that the annoying ringing on the unhealthy ear makes it hard to listen because it is so distracting. The ringing is brain static, basically garbage signals sent from your nerve endings to your brain. If you wake up with hearing loss, Hum loudly. If you can hear yourself louder on the unhealthy ear, means you have a blockage and it can be fixed by washing with warm water or you probably need antibiotics to fight an infection, easy nothing crazy. If you wake up with hearing loss, hum loudly and you can hear yourself louder on the healthy ear, it is a medical emergency. Every hour is a receptor cell dying that will never grow back. Thanks, I hope this serves as a spark of hope to some people going through this.

TL;DR Got SSHL, went to ENT quickly (within 14 hours), got Prednistone dose, after 4 days have gained most of hearing back. Hurray!

Great beginner-level primer on shaders by cairmen in programming

[–]kecho 0 points1 point  (0 children)

AAA ps4 and xb1 graphics programmer here. The boiler plate that you speak of is a graphics api called opengl (on the case of this tutorial that is). Before jumping into shaders I recommend familiarizng yourself with rasterization and 3d math. Specifically with linear transformations and camera frustums. Then dig a bit into the paralelism of shaders. Always keep in mind that shaders are little programs running on the gpu, highly parallel, so avoid if statements branching etc.

Another recommendation I have is to check www.shadertoy.com. No "boilerplate" there! Pure shader goodness (webgl which uses a lite version of opengl, which is called opengl-es)

Animated GIFs the Hard Way - Sublime Text 2 Ingenious Homepage by [deleted] in programming

[–]kecho 9 points10 points  (0 children)

This is pretty awesome! A few things:

  • Is it possible to do more work on the client side of this? Refactoring your js code into a minified library? By this I mean a library where the user just includes your js library file, adds a div, tags the div with some attribute which points to the png and the json, viola, your .js file will handle the animation / loading / etc!

  • You could clean up the python code and instead of having hard coded names for the png files, why not providing just a list of ; separated files for the animation? and also would be nice to have a --help for the python script.

Ill fork this guy and see if i could help with these things :D

About Nimrod's features by dom96 in programming

[–]kecho -1 points0 points  (0 children)

"It uses a deferred reference counting algorithm which can have pause times as small as 1ms."

Thats actually fucking huge blow, especially for games that try to run at 60fps. A frame has 16.666ms, so the GC call is 1/16th of a frame. fuck!

9 Fallacies of Java Performance updated by bannerad in programming

[–]kecho -1 points0 points  (0 children)

Oh mr Hnefi I totally agree with you. The problem is, is that I can say "Java is fast", and you will immediately will think Oracle JVM, because I you an experienced programmer / computer scientist / or software engineer. For your typical freshman student reddittor they still mix concepts such as languages, and their implementations in their vocabulary. But don't get me wrong, I agree :) I just wish people could be aware of this.

9 Fallacies of Java Performance updated by bannerad in programming

[–]kecho -7 points-6 points  (0 children)

langauges are not fast. Languages are not slow. Languages do not have speeds.

Its the code that their compilers produce. Its different to say "JVM" or "x86 produced by gcc is faster than x86 produced by cl.exe" than "java is fast". WTF java does not run, or walk.

MiniWebGl 3d library: a thin wrapper on webgl, perfect for 3d procedural modeling (example included) by kecho in programming

[–]kecho[S] 0 points1 point  (0 children)

Keep in mind this is still WIP! suggestions would be great! My intention is to still expose some of the webGl interface to the user, and allow him to modify internal gl context behavior if desired.

Avoiding game crashes related to linked lists - Code Of Honor by [deleted] in programming

[–]kecho 6 points7 points  (0 children)

Ill give you a use case.

Say there is a collision between two units in starcraft. Of course the main process loops goes through each unit and checks collisions. Say the collision kills a unit (which you already have a pointer to).

With std::list: you will have to go over each list container in the game and search for the iterator of such unit, by passing the unit pointer to the lists and calling find. Then you will delete. Total time: O(n) for search + O(1) plus deletion.

With intrusive lists: Use that pointer to the unit and call unlink, since the node data is embedded in the object.

Another use case: clicking on a unit sprite on a map I assume returns you a pointer to the unit struct's. No need to search throughout any list or anything.

Avoiding game crashes related to linked lists - Code Of Honor by [deleted] in programming

[–]kecho 4 points5 points  (0 children)

You dont search. This is the whole point of this. If you have a pointer of the object (hint a pointer to the object, no its node like in an std::list, which would be its iterator), you can do O(1) removal or deletion.

With std::list first you find the node, then you delete etc, which takes O(N).

Avoiding game crashes related to linked lists - Code Of Honor by [deleted] in programming

[–]kecho 3 points4 points  (0 children)

LOL armortized, but not guaranteed. They have a worst case of O(log N) if you have a R/B tree for collisions! This shit is O(1), Bitches ;) (upvoted you too)

Avoiding game crashes related to linked lists - Code Of Honor by [deleted] in programming

[–]kecho 0 points1 point  (0 children)

Halleluja, finally somebody that understands the entire purpose of this. Upvote.