Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:20 03 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM2 Playing with CFunctions LTRIM,RTRIM

     Page 2 of 2    
Author Message
piclover
Senior Member

Joined: 14/06/2015
Location: France
Posts: 134
Posted: 01:45pm 20 Jul 2017
Copy link to clipboard 
Print this post

  twofingers said  
@piclover

Thanks for your contribution! This is meant as a discussion thread therefore your example is highly welcome.

Is your code also free for anybody - without any restrictions - like mine?[/quote]
Sure thing, this is copyleft code. Use it as you wish.

[quote]I converted the code into a CFunction and it seems your code is significant faster than mine (for longer strings about 10%) .[/quote]
And it will be even faster when there's nothing to trim in the string (no memory reservation, no string copy), which is a very common case you will want to process as fast as possible.

[quote]On the other hand my code takes less memory. This just as information.[/quote]
The size of optimized programs is sometimes larger, yes, because we take several cases into account to skip useless code (more tests), but in the end, the few bytes lost are very worth the speed increase...
Also, depending on your compiler optimization level, the differences in both code size and speed can vary a lot, independently of the quality of the source code optimization...
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 05:07pm 20 Jul 2017
Copy link to clipboard 
Print this post

  CaptainBoing said  
  paceman said   How do you intend new code or snippets to be added to the Wiki? Is this going to be up to each account holder or will you be putting useful things like this Cfunction of Michael's into it?
BTW: I'm not familiar with how Wiki's operate but I guess I'll learn. Do you have a link to a good primer, preferably less than 20 pages long.

Hi Greg. Anyone can browse the code etc with no restriction. Having an account allows you to add your own code, modify existing pages (to improve/discuss/correct) etc.....

Wikis are really easy to drive. Posting on TBS has already got you in the mindset of using Markup to make sections stand-out. (One thing that always catches new users is uploading images and attachments - they have to be done before you need them in a page - this allows images to be shared between articles as they are not compartmentalized to a single page.)
Here is a nice <20 page primer.....


Late getting back to you CaptainB but thanks for the above. Your 'quick crib' from the post was pretty handy but I've also read the markup and other info on your linked Wiki software site. So I'm 'full bottle' now - all I need is a new brain. I'm off up North to catch some much needed sunshine tomorrow for a couple of weeks (winter here in Melbourne) so I'll give it a go when I get back.

Greg
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024