# [SDL] single pixel drawing

Atrix Wolfe Atrix2 at cox.net
Thu Jul 18 16:17:00 PDT 2002

```yeah i just like looking at this from a scientific angle, seeing what is the
most efficient way for execution, even if it isnt the most efficient for
developement. Its kinda neat the depth you can go in just to do something as
simple as drawing a pixel.

----- Original Message -----
From: "Bob Pendleton" <bob at pendleton.com>
To: <sdl at libsdl.org>
Sent: Thursday, July 18, 2002 3:43 PM
Subject: Re: [SDL] single pixel drawing

>
>
> Atrix Wolfe wrote:
> > how bout at run time you factor the pitch into powers of 2 and then
> > create your full pixel drawing function (if there are 100 dots drawn put
> > the for loop in and such) and "compile" it to the native machine code.
> > Hows that for efficiency?
>
> That pretty good, we used to do things like that back in the days of 10
> megahertz 286s because we needed to. In these days where a stinking slow
> computer runs at 100 megahertz and a reasonable new computer runs at 800
>   to 2200 megahertz, it seems like a waste of life span to even worry
> we can do (s*y)+x using 1 shift and 1 add I can do it in 2 cycles and I
> spend 200 cycles on arithmetic and if I need 2 shifts and and 2 adds I
> spend 400 cycles, and if it take more shifts and adds than that then I
> should use a multiply becasue a mulitply and and add are 5 cycles (all
> this cycle information is from previous posts and seems to be based on
> the original Pentium which you can buy at thrift stores for a couple of
> bucks...) Anyway, the difference is at most 300 cycles per frame.
>
> So, at 1000 megahertz 300 cycles is 0.0000003 seconds. That's how much
> you might save wow, remind me to waste hours arguing about how to save
> 0.0000003 seconds again. Life is too short to be worrying about
> 0.0000003 seconds. Get some perspective people.
>
> Bob Pendleton
>
>
>
> --
> +------------------------------------------+
> + Bob Pendleton, an experienced C/C++/Java +
> + UNIX/Linux programmer, researcher, and   +
> + system architect, is seeking full time,  +
> + consulting, or contract employment.      +
> + Resume: http://www.jump.net/~bobp        +
> + Email:  bob at pendleton.com                +
> +------------------------------------------+
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>

```