2018
April Tuesday 24

Bookmark and Share

Related Articles...

MILWAUKEE WI Arduino Meet Up Make Space

WANTED: CORE TEAM MEMBER TO HELP START NON-PROFIT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Arduino Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Raspberry Pi Meet Up Make Space

WANTED: CORE TEAM MEMBER TO HELP START NON-PROFIT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Raspberry Pi Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Internet of Things (IoT) Meet Up Make Space

WANTED: CORE TEAM MEMBER TO HELP START NON-PROFIT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Make Space Acquired!

Full Advanced Fabrication Facility, machine Shop, Welding, Electronics Lab Equipment Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Machine Repair, & Installation  - Tier 1 Business Support

Machine Technician Mechanic 20+ Years  Personal Experienced In Industrial Factory Machine Servicing, Rebuilding, Installation And Repair - Plus A 35+ Years Experienced Computer Engineer Service Technician Team Ready For Your Outsourced Market Advantage Needs!

Hartung Industrial - Member - CGI Science & Technology Group

Email :

COASMailBox @ gmail.com

2018 JAN REVIEW

Arduino Open Source Community member - Tier 1 Full Stack Developer

Arduino If, Or Case?

PERFORMANCE TUNNING ARDUION PROGRAMS | IF Or CASE FASTER?

2018 JAN | by Gene Casanova

Senior Systems Engineer; Software Engineer


Optimizing Processing

Performance tuning, should become the normal and typical way a high grade professionally-disciplined programmer creates all programs.

Seek a deeper understanding and get into the practise of using optimized code constantly.  By doing this, you become a marketable skilled person and create wonderful and effective results effortlessly and in a timely manner.  Life is short and no one has time to waste relearning bad habits and poor quality programming.

This guide focuses on a quick answer, which is faster, IF or Case logic, processing in the AVR of an Arduino embedded microcontroller IC chip.

The absolute key to optimized code, is to create a few alternatives, and run the code using scientific procedure - document all processes - there is no failure in implementing scientific procedure.  You learn what works and does not work; both valid facts!


IF

Sample optimzied logic source-code, using If logic:

// Optimized Logic Processing Example:
uint8_t brightness_12(const int8_t led, const int8_t pos) {
	int8_t diff;
	diff = led - pos;

	if( diff < 0 ) diff = -diff;	// 1 line logic.

	// Test for most common case first:\
	
	if( diff > 3 )  return 1;

	// Then process less common cases:

	if( diff == 3)	return 2;
	if( diff == 2)	return 6;
	if( diff == 1)	return 16;
					return 32;
}

This source code is 42 bytes, 21 machine instructions, and processes the logic most efficiently.

Replaced:

uint8_t brightness_12(const int8_t led, const int8_t pos) {
	switch ( abs(led-pos) ) {
	 case 0)	return 32;
	 case 1)	return 16;
	 case 2)	return 6;
	 case 3)	return 2;
	 default: return 1;
	}
}

This source-code compiles to about ~80 bytes; 40 machine instructions.


Arduino Open Source Community member - Tier 1 Full Stack Developer

Arduino Awesome

Arduino is an awesome opportunity, for anyone to start easy and having fun, learning about microcontroller programming, and gaining enlightenment and sparking imagination/dreaming of things yet to come!

Build cool stuff, have fun experimenting, learning, tinkering, fixing, making new products.....  Iot - Internet of Things, to Cool Toys, Models, Drones, Robots, Automating House Things, Factory Assembly Automation, Model Railroading, Hobbies, Crafts.... Have Fun - Dream.... Imagine.... Build.... Produce..... ENJOY!

HAVE FUN!

Clubs, Groups, Schools, Organizations, Corporations... I Make Myself Available For Professional Speaking And Instructing Engagements.


Arduino Open Source Community member - Tier 1 Full Stack Developer

'IoT & Embedded MAKER SPACE - MKE'

Join the embedding computing community, group, center, team............

Discover, Try Out, Learn, Experiment, Share, Create, Produce, Build, Sell.... one or all of these activities, liked minded open soruce group/center in MKE..... Craft, hobby, professional learning, start-ups, join a OEM team.......

CONACT to learn about a new group in METRO Area of WI & IL - Milwaukee, Racine, Kenosha, South Eastern WI And Northern IL, space and/or spaces - Forming Now!

We Have Industrial Zoned Making Space With Outfitted Machine Shop And Lab Space Available!  Multiple Dedicated Online Locations Available In Milwaukee 3rd Ward.

I am building a network of creative Makers/Doers!... Come Learn More, Join, Engage, Enjoy, Create A Solid Future Of Fun And Reward... Come Help..... Core Team Members Wanted, Or Simply be A Hangout Member Learning, Socializing/Networking... Start-Up Incubator Space, Students Tutoring Space, Retired... Hobbyists, Educators, Scientists, Researchers, Developers...

Mega Industrial Machines Building!!!!  AI Development.... Super Computing.... @ Tier 1 Level.  Locations looking to establish a network space, include Chicago IL, Melbourne Vic Australia.


Use The Technology Wisely & Keep It Simple

- Cheers!

Gene Casanova


Need More?   Need Help? ........Software, Network, System & Data Center Builder & Developer | Development Services Available - Freelance Small Jobs; To Outsourced Long Term Service Provider Contract Labor Available.

CGI Computer Wares | EST 1979

Send E-MailCONTACT: [click]@CGIComputerWares.com