Any libraries that speed up the arduino?

So recently while working with the arduino i discovered how long the digitalWrite() function takes. searched it up online and found that the way to speed it up is by using assembly commands, because the function itself has a lot of safety nets that make sure the statement isnt invalid.

now i don't really know how the assembly commands work so i was wondering if there are libraries that speed digitalWrite up, by for example only checking the pin once at the beginning and then every other iteration of that pin it already knows not to waste time on checking. and if this doesn't exist i'd like to know if something like this is possible and if it would actually speed my arduino up.

thanks, paul.

I have to ask: Why do you care?? I've written TONs of applications, some very complex, and always used digitalWrite. It has never once been a problem, and I have never once felt any need whatsoever to resort to assembler. With EXTREMELY rare exceptions, I'd have to say that if the speed of digitalWrite is a problem, you're probably doing something very wrong somewhere. Or, perhaps you're in search of theoretical optimization in an area that really has no real-world benefit.

Regards, Ray L.

and of course you have done this and you were not satisfied with any of the results, right?

What was wrong with this one or that one?

it won’t speed up your arduino though, your arduino runs probably at 16Mhz. what it does is less instructions being used, so possibly winning a few micro seconds for your code… Now does your code need a few microsecond performance improvement?

whelp, found a library that does exactly what i was looking for, its called DirectIO.

yeah i guess i shoulda searched outside the library, sorry.

Calling library functions to do direct I/O unnecessarily wastes CPU time.

jremington: Calling library functions to do direct I/O unnecessarily wastes CPU time.

CPU time that 99.999% of the applications here have absolutely no other use for.... Regards, Ray L.

Why not just write to the registers directly? If you need speed, instead of farting around with libraries, just write the PORTx/PINx/DDRx registers directly.