Random programming talk | I have no Structs on my List


#1

We have a few people that program either professionally or for fun, so let’s post questions or interesting links to programming topics.

If you don’t program but are interested, feel free to post and ask any questions.

How do you post code here?

Inline `code` has `back-ticks around` it.

Inline code has back-ticks around it.

Blocks of code are either fenced by lines with three back-ticks ```, or are indented with four spaces. I recommend only using the fenced code blocks – they’re easier and only they support syntax highlighting.

More info: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code


#2

http://gpfault.net/posts/intrusive-lists-doom3.txt.html

####Less Memory Management

First of all, consider how a non-intrusive list like std::list is likely to be implemented. Under the hood, it will have some structure, like “ListNode” which is comprised of the object that the list holds as well as pointers to the next and previous elements. Something like this:

template <class T>
struct ListNode {
  T object;
  ListNode *next;
  ListNode *prev;
};

What happens when you add items to a non-intrusive list? A ListNode structure silently gets created and initialized. Of course, it must occupy some memory, so that memory has to be dynamically allocated. Thus, an insertion operation results in a memory allocation being made behind the scenes. We have a similar situation with removal: every time you remove your object from the list, the corresponding ListNode has to be cleaned up, which is another call to the memory manager.

Now imagine a situation when you are playing your favorite shoot-em-up, and you just got an awesome power-up for your machine gun that makes it shoot eight projectiles in different directions at once, at a higher rate. Now you can unleash a furious torrent of deadly fire on your digital opponents, but let’s think about what’s going on behind the scenes. There’s a ton of projectiles on screen, and each of them is probably a member of multiple lists, for example : list of all entities, list of renderable things, list of moving things, and possibly others. Every time a new projectile is created it has to be added to a bunch of lists. There can be a lot of projectiles, they appear and disappear quickly, and every time that happens we incur the cost of allocating/deallocating memory multiple times.

With intrusive lists, you don’t have to pay that price, because the space for your list nodes is already there within your object, so the allocation is done only once.


#3

@archnemesis @Jibril @Alistel @OneEightZero (I know you switched but in case you still might be interested)


#4

Good stuff.
@chapel will be pleased to know I am loving NodeJS lately.
NodeJS is awesome, what kind of things would you suggest to someone if they want to be considered legit in NodeJS.


#5

That’s a clever way to handle all those processes going on at once. I had always pondered how the code-end organized all the movements of characters, enemies, NPCs, and particle effects in a game, specifically, an FPS, where you’d typically find fast-paced action and general chaos occurring at any given time.

Every time I get on the subject of programming, I have feelings of conflict. I don’t have any other passion or drive other than being a game developer–and I’ve only thought about being a game programmer (I considered becoming a level designer or general graphic designer). When I think about what career I want to go down as a dream job, it’s a game developer, but a game developer isn’t a secure job to have. Layoffs are more susceptible to people making games. On the other hand, the safe bet would be an accountant or contractor (electrician or plumber). You’ll make fair money with either of those career fields, perhaps a lot more with the former. Though, the sensible plan would be to choose a career that will guarantee a job and good money, then I can continue to learn programming on the side.

Anyway, I want to go back and continue taking python lessons. It’s getting challenging at the lesson I’m at now.


#6

#7

http://heeris.id.au/2014/if-programming-languages-were-harry-potter-characters/


#8

#9

The “Invent with Python” Blog | No, Seriously, Why Should I Learn to Code?


Topics covered in this book include:

  • Basic Python Programming
  • Text Matching with Regular Expressions
  • File Handling
  • Debugging
  • Web Scraping with the Requests, BeautifulSoup, and Selenium Modules
  • Reading PDF and Word Documents
  • Interacting with Excel Spreadsheets
  • Parsing CSV and JSON Files
  • Scheduling Tasks
  • Sending Emails and SMS Texts
  • Image Manipulation with the Pillow Module
  • Controlling the Keyboard and Mouse through GUI Automation

http://automatetheboringstuff.com/


#10

http://www.pagerduty.com/blog/the-discovery-of-apache-zookeepers-poison-packet/

Well worth the read.


#11

9 Anti-Patterns Every Programmer Should Be Aware Of


split this topic #12

I moved 2 posts to an existing topic: Random Talk | Say whatever’s on your mind


#13

What’s your favorite JavaScript framework chapel? I did some basic AngularJS a couple of years ago. It seems like that’s still the best choice if I wanted to do a app-like front end.


#14

The bunny theory of code


#15

I’m not a fan of the more magical frameworks like angular and ember (Discourse is made with ember).

I prefer modular and composeable libraries. Backbone is nice for composing but not modular. Ampersand is like Backbone, but modular so I like it. I also like Reacts rendering and the ideas behind flux, but not 100% sold on React as is. Better than most though.


#16

I built a tiny prototype website yesterday. Eventually I would like to replace it with a fancy single-page application. Using one of the popular frameworks should be easier than trying to make something from scratch.


#17

#18

Goodbye, SourceForge!


#19

#20

hey dudes sorry to bother you guys but i’m thinking of actually learning web dev, i looked around and just started with CodeCademy, but i was wondering if you guys had any suggestions

i don’t know if i can afford actual professional courses so i’d like to start by learning by myself for now and see how far i can get, and i’d rather learn stuff from scratch rather than use squarespace and the sort because i’m really hoping to get a job doing this someday and i want to be the very best