Any C language programmers?
Author
Discussion

ianMD

Original Poster:

2,893 posts

202 months

Wednesday 3rd July 2019
quotequote all
Do we have any C language programmers on here that either work for a company offering such services in the UK, or freelance? Need some code assessing and developing and don't know where to turn; not had much success from upwork etc.

C is used for its low-level capabilities for the task in hand (querying a server hundreds of thousands of times per day); I'm not aware of an alternative language that can compete.

zippy3x

1,384 posts

298 months

Wednesday 3rd July 2019
quotequote all
I don't code in C and I'm not looking for work (so hopefully see this as impartial)

My first question would be Why?

If you're doing 500,000 requests per day, that's one every 173 milliseconds (assuming the requests are evenly spread)


Why do you need to query a server that often?

otolith

69,613 posts

235 months

Wednesday 3rd July 2019
quotequote all
I think most C (and assembly) guys these days are working on embedded stuff where the performance/resource equation makes it difficult to use something more modern.

Depending what you are doing and what you are doing it on, some of the modern languages are performant enough for most situations. When you say "querying a server", do you mean remotely? In that case, unless you are doing something intensive with the data, you're going to spend more time in network overhead than processing.

Can you say anything more about the problem?

C0ffin D0dger

3,440 posts

176 months

Wednesday 3rd July 2019
quotequote all
I am, well C++ mainly but that's just object orientated C innit. Not looking for work though. As a company we've usually been able to get contractors as and when we've needed extra hands but I've not been personally involved in that procurement. Maybe you're not looking in the right places?

ianMD

Original Poster:

2,893 posts

202 months

Wednesday 3rd July 2019
quotequote all
otolith said:
I think most C (and assembly) guys these days are working on embedded stuff where the performance/resource equation makes it difficult to use something more modern.

Depending what you are doing and what you are doing it on, some of the modern languages are performant enough for most situations. When you say "querying a server", do you mean remotely? In that case, unless you are doing something intensive with the data, you're going to spend more time in network overhead than processing.

Can you say anything more about the problem?
Not so much a problem, looking for improvements.

My script operates from a dedicated server close to the destination servers, designed at querying their database for an answer, which typically takes a round trip of less than 2ms. When one answer is given, it keeps checking (typically 10 times per second), one another answer is given, it performs an action to register something.

Latency etc is all factored in, and of course is a key component. The rest is down to how quick the code can react to a situation, which I believe is where code language like C is outperforms others, such as Perl, Python, PHP etc.

davek_964

11,354 posts

206 months

Wednesday 3rd July 2019
quotequote all
So is this optimising existing C code, or starting from scratch?

silverous

1,008 posts

165 months

Wednesday 3rd July 2019
quotequote all
otolith said:
I think most C (and assembly) guys these days are working on embedded stuff where the performance/resource equation makes it difficult to use something more modern.

Depending what you are doing and what you are doing it on, some of the modern languages are performant enough for most situations. When you say "querying a server", do you mean remotely? In that case, unless you are doing something intensive with the data, you're going to spend more time in network overhead than processing.

Can you say anything more about the problem?
I love the word performant. I've used it a fair few times over the years but no one ever seems to agree that it is actually a word. Sorry not on topic.

ianMD

Original Poster:

2,893 posts

202 months

Wednesday 3rd July 2019
quotequote all
davek_964 said:
So is this optimising existing C code, or starting from scratch?
It could be either. Either the programmer will say what I have is pretty good but could implement x, y and z, or will suggest reasons why a full rebuild might yield improved results. The challenge is finding someone.

Scabutz

8,895 posts

111 months

Wednesday 3rd July 2019
quotequote all
ianMD said:
davek_964 said:
So is this optimising existing C code, or starting from scratch?
It could be either. Either the programmer will say what I have is pretty good but could implement x, y and z, or will suggest reasons why a full rebuild might yield improved results. The challenge is finding someone.
Rebuilding from scratch is rarely a good idea, you just introduce new bugs that have been ironed out of an existing system. What do you think about what you have? Is it performing the task its required to perform? You get a programmer in and say what should I did with this there is a pretty good chance they will tell you they need to re write and to pay them £500/day for 3 months to do so. If its falling over all the time or not performing well enough then ok but dont get it looked at for the sake of it

As for finding someone its not going to be easy and will cost. As mentioned above most people will be working in embedded stuff and others will have moved on from C. There is a huge shortage of staff out there.

Do you have much budget? You will be looking for a contractor but they will want £400+ a day and will be looking for a few weeks work minimum.

You will struggle to find a freelancer to do a couple of days work.


otolith

69,613 posts

235 months

Wednesday 3rd July 2019
quotequote all
ianMD said:
Not so much a problem, looking for improvements.

My script operates from a dedicated server close to the destination servers, designed at querying their database for an answer, which typically takes a round trip of less than 2ms. When one answer is given, it keeps checking (typically 10 times per second), one another answer is given, it performs an action to register something.

Latency etc is all factored in, and of course is a key component. The rest is down to how quick the code can react to a situation, which I believe is where code language like C is outperforms others, such as Perl, Python, PHP etc.
Highly optimised C/C++ will match or outperform most things, but C# and Java can get similar numbers on many benchmarks. Depends what exactly you are doing. Is it maths? Text parsing? Lookups? Often a good algorithm makes more difference than the language its written in.

steve-V8s

2,924 posts

279 months

Wednesday 3rd July 2019
quotequote all
I work with C and assembler but not looking for any work at the moment, particularly with existing code. If needing something to work quickly and consistently I tend to use assembler. Don't think anyone will be keen to dive in without seeing what the code is like and how well it is commented first.

Scabutz

8,895 posts

111 months

Wednesday 3rd July 2019
quotequote all
steve-V8s said:
how well it is commented first.
Good code comments itself. :-)

Been telling myself that for years

otolith

69,613 posts

235 months

Wednesday 3rd July 2019
quotequote all
Scabutz said:
Good code comments itself. :-)
/*You are not expected to understand this*/

ianMD

Original Poster:

2,893 posts

202 months

Wednesday 3rd July 2019
quotequote all
otolith said:
Highly optimised C/C++ will match or outperform most things, but C# and Java can get similar numbers on many benchmarks. Depends what exactly you are doing. Is it maths? Text parsing? Lookups? Often a good algorithm makes more difference than the language its written in.
Essentially lookups waiting for a one-time specific response to then fire off a command to register something.

essayer

10,410 posts

225 months

Wednesday 3rd July 2019
quotequote all
I’d consider the whole stack, not just the C code. Network drivers, switches etc. When you’re in the ms level every little helps.

otolith

69,613 posts

235 months

Wednesday 3rd July 2019
quotequote all
ianMD said:
Essentially lookups waiting for a one-time specific response to then fire off a command to register something.
I would think that Java or C# using a suitable fast data structure would be pretty damn quick, to be honest.

Most of our performance optimisation goes into databases, because that's where most of our overhead is, but we've recently done a lot of work in chewing through large files quickly. Different sort of problem, though, and more focused on making processing time as close to O(n) as possible (bits of the files need lookups to other bits of the files).

ianMD

Original Poster:

2,893 posts

202 months

Wednesday 3rd July 2019
quotequote all
Yes, this comes down to response times and how fast it reacts. The whole compiled file is only 27KB! I'm operating close to the peak possible with sub 2ms response times; the rest likely just latency on the line.

768

20,819 posts

127 months

Wednesday 3rd July 2019
quotequote all
otolith said:
ianMD said:
Essentially lookups waiting for a one-time specific response to then fire off a command to register something.
I would think that Java or C# using a suitable fast data structure would be pretty damn quick, to be honest.
Probably. 2ms is pretty small though, especially if you care about things like gc pauses it could take some fairly specialist knowledge. Must be easier to find a good Java dev than even a poor C dev these days though.

Also sounds a bit backwards as an approach, I assume there's a reason it's polling rather than being pushed from the other side.

tribbles

4,175 posts

253 months

Wednesday 3rd July 2019
quotequote all
I've done the whole gamut from assembler to C# (and more - just going down one side of the programming languages).

My concern is that you want to query a server - the main delay would be the networking, unless you've got a lot of parsing and interpretation of data to do.

If the data is simple, then any language overhead (such as byte code or CLR) would be minimal compared to the network delays.

If the data is complex, then you may find that using a higher level language would be easier to prove it's right (easier to understand and follow). But you could start with something that uses a higher level, and get that to prove some lower level language.

A few years ago, I did a conversion of C to ARM assembly of MPEG video decoding, and converted functions at a time and profiled the changes to see if they did the right thing - and that would be my approach for complex data that needs performance.

Eta: I didn't read the whole thread, and didn't realise it had already been mentioned smile

dcb

6,070 posts

296 months

Wednesday 3rd July 2019
quotequote all
ianMD said:
Do we have any C language programmers on here that either work for a company offering such services in the UK, or freelance? Need some code assessing and developing and don't know where to turn; not had much success from upwork etc.

C is used for its low-level capabilities for the task in hand (querying a server hundreds of thousands of times per day); I'm not aware of an alternative language that can compete.
I am long since retired from this kind of thing, but for a few beer tokens
I could be persuaded to have a shufti at your code.

When you say "code assessing" do you mean static or dynamic analysis ?
What platforms does the code run on ? If it is Microsoft, then I am out.

How much code are we talking about here ? If it is < 10K lines,
that's pretty much student project level and so should be pretty
easy to assimilate.

I've only been doing C code since 1985, so I am still fairly new to it ;->