FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Avoid using % in BigQueueC. by raidoz · Pull Request #354 · tinyos/tinyos-main · GitHub

This repository was archived by the owner on Apr 12, 2026. It is now read-only.
/ tinyos-main Public archive

Avoid using % in BigQueueC. - #354

Open
raidoz wants to merge 2 commits into
tinyos:masterfrom
thinnect:bigqueue
Open

raidoz wants to merge 2 commits into
tinyos:masterfrom
thinnect:bigqueue

Conversation

raidoz commented Sep 29, 2015

Copy link
Copy Markdown
Contributor

BigQueueC is faster when % is not used.

vlahan commented Sep 29, 2015

Copy link
Copy Markdown
Member

Hi Raido,

can you quantify the improvement? On what platform did you notice this to be a significant performance issue? We should be careful not to start changing files only because we don't like the existing style if the benefits from the change are marginal.

--Vlado

raidoz commented Sep 29, 2015

Copy link
Copy Markdown
Contributor Author

It was an old internal change that I stumbled upon, but if I remember correctly, then the modulus operator started to have a noticeable effect on performance when doing a lot of printf(which uses the queue internally) at high baudrates(like 500000) on an Atmel RFA1. Or rather we were able to print a lot more if we replaced the % operations.

I can also refer to http://embeddedgurus.com/stack-overflow/2011/02/efficient-c-tip-13-use-the-modulus-operator-with-caution/ as a reason to avoid the % in such cases for AVR and MSP. This substitution will probably not have much effect for ARM, but I don't think it will hurt either.

raidoz commented Oct 1, 2015

Copy link
Copy Markdown
Contributor Author

Changed the if to a while. I would expect the action to normally not run at all or run just once, so should still be better than the %.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL