Looking for poorly optimized code [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I posted this on daniweb, but have revised my thoughts on the matter.
Basically my 'Integrated Software Systems' class midterm is to take some code (either you wrote or someone else's) and optimize it.
I thought to myself why not use this opportunity to enrich the open source community, I know it's really going to only be a function or so, but if more people from the course were interested maybe it would make some progress for some projects.
So does anyone know of any functions or small chunks of code (nothing really large), that would be somewhat easy to stub out and just run independently of the rest of the code, and just work on optimizing it, especially pieces that need to run fast, that are in an open source project?
I'll definitely post this on my blog and refer people to this question for people wanting ideas on functions to work on from my course.
Frankly I've been tired of just doing work that is academia only and it really isn't helping anyone except learning theoretical stuff, I would rather put it to good use and help others.

ATLAS - might be hard to improve, but if you do, big kudos
UBLAS - may be able to improve some common expression patterns
sympy - python code, some routines are slow. developers would definitely appreciate help.
Probably sympy would have greatest payoff in terms of improvement. Atlas would be nearly impossible to improve in my opinion.
you could also check out projects links on oonumerics.org, but if you do choose project, make sure it is still active. the projects are grouped by their fields so you have a lot to choose from.

You can download the code for this travelling salesman solver and optimize it: http://www.gebweb.net/optimap/

How about a nice little game of Boggle?
There's probably ways to optimize string comparisons, loops, search algorithms, caches.

Related

Need exercises of data structure [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I started programming last year, so I'm still kind of slow in it. Right now I'm learning data structures in C, and I'm having a hard time finding things to practice it, so could anyone point me to some(or a lot of) exercises concerning trees, lists, recursion, heaps, graphs, and the theoretical things regarding data structure performances?
this website is particularly for the data structure interview questions. But I found it quite helpful :).
Try writing programs for factorial,Fibonacci series, or you can solve some sorting algorithms(Like merge sort,bubble sort - for recursive algorithms), and also their are searching algorithms(Binary Search) that you can practice. for problems on trees you can try some coding or encoding algorithms. For practicing graphs the best example can be prim's and kruskal algorithms.
Regarding data structures performances you can go through the concepts of Space complexity and Time Complexity.
Sphere online judge has a load of little exercises you could get your teeth into :)
In brief, quoting website, SPOJ is "... a problemset archive, online judge and contest hosting service accepting solutions in many languages..."

What is a good embedded TLS library? (Cyassl vs Polarssl vs Matrixssl) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have looked around for good SSL/TLS libraries that support TLS 1.2
I also want to use this library on an embedded platform so it should be small, easy, secure and free. It should be a c/c++ library.
So far i have come across Cyassl, Polarssl Matrixssl a lot so i think that one of these should be a good choice (Openssl is way too big).
Now i would like to know why people use one over the other.
Thanks
Ok.. Just for starters they all do the same. All three can run on embedded platforms. The difference is where their focus is.
From my personal experience:
PolarSSL has loads of documentation, an understandable API, examples, and gives you the ability to actually delve into the code and understand what is happening. In my experience this is a great plus in case you need to debug a specific issue. They only provide Makefile / CMake / MSVC project files, so the task to include it in your embedded environment is yours.
Cyassl's code is harder to understand and tweak. But they have more pre-made Makefiles for specific development platforms. Depending on your environment this might weigh in (for me it rarely does). In a number of comparisons I did as a subcontractor, they are pricier than PolarSSL though.
Pick MatrixSSL if you don't have budget constraints ;) Definitely the priciest of all and I found no specific reasons to actually use it though in comparison to the alternatives..
With the whole NSA / PRISM thing around: If you want something specifically built in the US, then Cyassl is the best choice. If you want something non-US, PolarSSL is the only sane choice.
So if by free you mean: I'm going to use it in an Open Source project, then price does not matter. The verdict from the community: PolarSSL has good adoption in OpenVPN, Cyassl in MySQL.

What open source C projects are worth studying for learning good design? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
What small open source projects in C are interesting for learning good design?
The project should be:
Not too large (like the linux kernel)
Well documented
Perhaps still under active development
I've just started learning C, and while the language itself is not too difficult, i'm struggling how to design larger applications, so i thought checking out other open source projects would be a good starting point.
Thanks!
Redis (nosql db) is:
under active development
a manageable size
portable and robust
has no external dependancies
very well written, understandable code
In my opinion, good examples of moderately sized projects written in C are:
GNU Scientific Library (besides the source code, don't miss their design document)
Kazlib
Git
Posix threads are a perfect example of good C design
I like gnucash: http://www.gnucash.org/
No too large like Linux kernel, but still big I think.
You can start learning from small and well structured applications like http://abygaelle.guillaume-fr.net/trac/gemmes
It all depends what kind of projects you are interested in. And what aspect of it (specific algorithms, UI, networking, etc, etc...)
Head over to freshmeat, sourceforge or ohloh and browse the projects for your area of interest.
Alternatively if you want to look at projects that were chosen for a particular reason google summer of code might be interesting for you - even though these rarely include full projects.
EDIT:
Also alternatively, you might take something like linux kernel, but instead of trying to understand everything try to
get the big picture
then concentrate on one tiny piece of it and inspect how the code changed over time (and for what reasons - it should be quite well documented)

Best online source for learning C [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Im an experienced actionscript developer, and relatively new to Objective C.
I decided a good investment of my time would be to master the C language (not C# or C++).
Can anyone recommend the 'best' online tutorials for learning C?
You won't have difficulties understanding the C syntax given your past experience, and unfortunately, most tutorials and introductory books will focus on it much more than they should.
C is full of traps, but it is a simple language which gives you full control on what is going on with your programs. However, it is difficult to master. You will need something more elaborated than a simple tutorial which will be half full of things you probably already know.
I definitely recommand K&R's book if you want to learn the language correctly. Be sure to grab the second edition.
I agree with James' comment, though I would recommend looking over the first paragraphs of a web based tutorial.
Though they're not the best for learning the language itself, you can get a feel for some trivial programs and see if they fit your brain.
The worst thing that can happen here is if you buy a book and can't use the language (for whatever reason).
As far as specific selections... I can't give you any.
As you've asked for online resources only, so here is one
http://www.cprogramming.com/tutorial/c/lesson1.html
Like Alexandre , I would also recommend K & R's book
You should check this out too:
http://www.phy.duke.edu/~rgb/General/c_book/c_book/index.html
I've looked through it, it's got some good examples and it's a good read.

Efficient network server design examples, written in C [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am interested in learning how to write extremely efficient network server software and I don't mind getting my hands dirty with pointers, sockets and threading. I'm talking a server being able to handle thousands of concurrent connections. There is not much processing for each client, but a little.
Do you know of any code examples for really efficient network servers?
Optionally points for small, well documented code that is cross-platform as well.
You'll find a lot of good references and discussion about building highly scalable network servers on Dan Kegel's The C10K problem page.
Have a look at nginx, lighttpd and varnish for some popular high performance http servers.
BTW, I am currently working on combining edge-triggered epoll with multithreading (plus user-level swapcontext-style threads/fibers) - see http://svn.cmeerw.net/src/nginetd/trunk/ for some work-in-progress code (although this one is written in C++).
This may not be exactly what you are looking for, but I briefly recall looking at Space Tyrant a few years back and thinking it sounded cool.
http://librenix.com/?inode=6240
Hope it helps!
Read this
http://www.evanmiller.org/lxr/http/source/
an ldap-server handles lots of transactions per second
http://de.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol
ACE is a wise choice.

Resources