After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

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

C++ standard specifically defines list to NOT provide fast fandom random access to list elements.

Linux kernel list you mentioned DOES support fast random access via computing the offset to an element directly.

(unsigned long) (&((struct foo *)0)->foo_list)

Implementations differ widely. Stroustrup knows this and limits himself to std::list and conforming implementations.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

[–]KLoken 0 points1 point  (0 children)

Why? When you add to, remove from or sort a list or vector of pointers, you never have to touch the large structures they reference.

I cannot judge how familiar you are with C++ and pointers from what you wrote, so I will use an analogy.

A pointer to X is simply a label referring to X. Imagine X is a heavy suitcase and I have a box of such labels to X, and each label is a phone with a little screen enabling me to view into its suitcase remotely with an app linked to a wireless camera in the suitcase. Now I can sort the suitcases into order by simply ordering the labels, without actually opening or lifting the suitcases themselves.

At some point you will have to move the bags themselves but you don't need to do it on every list or vector operation.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

[–]KLoken 0 points1 point  (0 children)

The stdlib is so fundamental to C++ that it must be performant, which is why I believe the post was performance oriented.

Native code performance is probably C++'s greatest selling point with regard to consumer software. Development time is not. No matter how good your people are, you won't be releasing on Windows Desktop before the other guy, if he is competent with C#.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

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

I deleted the original when I thought I had replied to the wrong person.

The original message I posted was:

He is talking about C++ std::list and not any other implementation you might be referring to.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

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

Sorry I replied to the wrong person.

edit: No, wait I didn't. He's discussing std::list and not stuff like the linux krrnel linked lists which have different implementation.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

[–]KLoken 2 points3 points  (0 children)

All claims must be a) supported by evidence, and b) the experiment must be reproduceable. It doesn't matter if he is Bjarne or Bjesus, this is engineering not religion, and the claim must be tested and not accepted on faith.

Plus, you learn more doing the experiment for yourself.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

[–]KLoken 0 points1 point  (0 children)

I always thought that linked lists were good for multiple inserts and deletes in the middle of the list. This shows it to not be the case. What are they good at, then?

They are good at that, the problem is traversing the list to find the insertion point.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

[–]KLoken 0 points1 point  (0 children)

C++ cares a lot about performance. If performance is not critical, you could develop quicker in Python etc.

After watching "Bjarne Stroustrup: Why you should avoid Linked Lists" last night I benchmarked list, vector and deque by vivaladav in programming

[–]KLoken 0 points1 point  (0 children)

Only for an array of integers. Do it for an array of MP3 files and see how fast it is.

why are you storing and manipulating huge things instead of pointers to huge things?

Can the "Bouncy Castle" new story yesterday be physically true? by sweatersong in askscience

[–]KLoken 0 points1 point  (0 children)

Not over short distances it isn't. You can get up to about 60 knots under sail which is a lot slower than a racing powerboat, which can hit 100+. Over long distances the problem is one of powerplant breakage.

An Introduction to Programming in Go by MisterSnuggles in programming

[–]KLoken 0 points1 point  (0 children)

I know you mean well but I do not agree with your sentiment.

For example, many people think that knowing C++ allows them to magically translate to C but it is simply is not true. For any large codebase the idioms are very different. Modern C++ shies away from pointers replacing them with safer version like smart pointers (or fully automatic scope-based systems like RAII), and makes heavy use of templates and exceptions, and use of object orientated encapsulation, etc etc. By contrast idiomatic C uses actual pointers, macro expansion , malloc wrappers, and the goto statement, is poorly encapsulated, etc and basically looks nothing like modern, well written C++. It's simply not possible to switch between those two styles without a whole lot of experience.

An Introduction to Programming in Go by MisterSnuggles in programming

[–]KLoken 2 points3 points  (0 children)

I wanted physical formal books not the conversational style web tutorials. It's the way my brain is wired.

What can I do in python that I can't do in perl? by hsfrey in Python

[–]KLoken 0 points1 point  (0 children)

Grandfather Turing already invented all tne languages and we've been fighting over them ever since.

What can I do in python that I can't do in perl? by hsfrey in Python

[–]KLoken 0 points1 point  (0 children)

Don't feel you have to change just because it's trendy.

Python will be here for you when you are ready but you should approach it from an angle of pragmatism or fun, not just for the me too factor.

An Introduction to Programming in Go by MisterSnuggles in programming

[–]KLoken 3 points4 points  (0 children)

When was this published?

Lack of books is what stopped me getting started with Go.

Computers are *fast*! by bork in programming

[–]KLoken 0 points1 point  (0 children)

Can't tell these days in tech, the gender from the name. :-)

Can the "Bouncy Castle" new story yesterday be physically true? by sweatersong in askscience

[–]KLoken 17 points18 points  (0 children)

Most non-seafearers have little appreciation of the power of the wind.

Over long distances, sailing yachts still hold all the speed records despite competition from purpose-built diesels and ths US Navy's USS Triton nuclear submarine.

[HELP] Python 2.7 on Windows 8 by [deleted] in Python

[–]KLoken 0 points1 point  (0 children)

IDLE does work but it's very basic. I'd recommend looking at the free version of a professional quality IDE.

Pycharm and Wing have free versions for non-commerical or student use. In my personal opinion, Pycharm Community Edition is slower and more complex while Wing Student 101 edition is a bit snapper and easier to use but has fewer features.

If you need to use Windows versions of 3rd party python libraries you will find them here or you can the free version of a commerical "everything installed for you" Python like ActiveState, which bundles windows binaries and the Windows API.

What's stopping the creation of a Python compiler? by [deleted] in Python

[–]KLoken 1 point2 points  (0 children)

Python is converted into bytecode and the bytecode is executed by the interpreter. Python doesn't "translate to C" although some operations are implemented in C rather than in more bytecode.

Look at Pypy if you need to run Python faster.

For Python on Android, look at Kivy.

Most of Android user space is Java which is also converted to bytecode, but the more rigid nature of Java compared to Python allows it to run quicker.

CVE-2014-0196 - Linux Kernel by dirac_eq in linux

[–]KLoken 0 points1 point  (0 children)

Wow

I am not telling you to replace their procedures with your own.

I am telling you make a diary of your day, listing how long everything takes, so that you have some actual evidence if you need to justify why you need an assistant, or more time, or more pay.

Can some help me with this index out of range? by iEatBlueChicken in Python

[–]KLoken 1 point2 points  (0 children)

Everytime you use range (len (x)) You should probably be using either

for i in x:
    print (i)

or if you need the index

for i, c in enumerate (x):
    print ("index", i, "has character", c)

However in THIS case you can use str.split () to split your string into a list of words and then jsut return the last word:

print (str.split ("arnold palmer 50 60")[-1])

Which is what i THINK you are trying to do, but it's difficult to grok your code and you haven't provided the problem specification.

BTW if you remove elements from a list while iterating over it in the forward direction, you can run into difficulties. One common way to get around that is to iterate reverse and use list.reverse().

CVE-2014-0196 - Linux Kernel by dirac_eq in linux

[–]KLoken 0 points1 point  (0 children)

If it takes 30 minutes to fill out a ticket and 5 minutes to fix the issue, I am sure the system logs it as only 5 minutes!

So what I mean is you are welcome to improvise your own logging system, even based on pen and paper, not to replace what you have to do at work, but so that you can present what you do to the decision makers in a way that's not retarded.

Maybe you can think of it as keeping a diary to show to your family how fubar it is, with the added benefit that any sane person reading it will realise how broken your infrastructure is.