Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #447948
| From | "F. Russell" <fr@random.info> |
|---|---|
| Newsgroups | comp.os.linux.advocacy |
| Subject | Re: Print to a .PDF file. |
| Date | 2018-04-07 00:12 +0000 |
| Organization | NewsGuy.com |
| Message-ID | <pa92ch01sun@news1.newsguy.com> (permalink) |
| References | (12 earlier) <pa7fsa0ock@news4.newsguy.com> <83d91e79-9416-401b-a586-55b8277ed03a@googlegroups.com> <b98cfd81-a808-4a52-8635-04e4fe3b8852@googlegroups.com> <q3SxC.307930$TS3.84842@fx18.am4> <3e01a40d-9522-41cd-bcac-b90ba8a51662@googlegroups.com> |
On Fri, 06 Apr 2018 15:04:58 -0700, Steve Carroll wrote:
>
> Possibly, but JavaScript is no longer just for web pages:
>
Oooh. The big javashit man thinks he is a real programmer.
Well, he knows nothing about how programming works. Let's
watch him flop with this simple exercise.
Below is the source of a C program that contains two absolutely
identical loops that do exactly the same thing except for an extremely
trivial, apparently at least, change. Yet the run times of the two
nearly identical loops are VASTLY different.
On my machine, here are the results:
Run Time Loop 1: 3.01377 seconds
Run Time Loop 2: 0.114614 seconds
Whoa! That a factor of over 30 times!
Why the difference? The two loops accomplish EXACTLY
the same thing, so why the execution time difference?
Ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha!
Dummy Carroll had better stick to his javashit with the
rest of the incompetent idiots.
Begin Short and Simple Source Code
=========================================
#include <stdio.h>
#include <malloc.h>
#include <time.h>
#define DIM (16*1024)
int main( int argc, char** argv ) {
size_t i, j;
int* mat;
double seconds;
clock_t start, end;
mat = (int*)malloc( DIM * DIM * sizeof(int) );
start = clock();
// ***** Loop 1 ******
for( i = 0; i < DIM; ++i ) {
for( j = 0; j < DIM; ++j ) {
mat[j*DIM + i] = 42; }}
end = clock();
seconds = (double)(end - start)/CLOCKS_PER_SEC;
printf("\n\nRun Time Loop 1: %g seconds\n\n", seconds);
start = clock();
// ***** Loop 2 *****
for( i = 0; i < DIM; ++i ) {
for( j = 0; j < DIM; ++j ) {
mat[i*DIM + j] = 42; }}
end = clock();
seconds = (double)(end - start)/CLOCKS_PER_SEC;
printf("Run Time Loop 2: %g seconds\n\n", seconds);
return 0;
}
=================================
End Short and Simple Source Code
=========================================
Compile with:
gcc -O2 -march=native -o carroll_flop carroll_flop.c
Back to comp.os.linux.advocacy | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Technical Help Needed Urgently -- MathJax "F. Russell" <fr@random.info> - 2018-03-31 13:48 +0000
Re: Technical Help Needed Urgently -- MathJax Melzzzzz <Melzzzzz@zzzzz.com> - 2018-03-31 13:57 +0000
Re: Technical Help Needed Urgently -- MathJax Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-31 07:06 -0700
Re: Technical Help Needed Urgently -- MathJax [SOLVED] "F. Russell" <fr@random.info> - 2018-03-31 15:09 +0000
Re: Technical Help Needed Urgently -- MathJax [SOLVED] "F. Russell" <fr@random.info> - 2018-03-31 15:06 +0000
Re: Technical Help Needed Urgently -- MathJax [SOLVED] Nobody <nobody@invalid.com> - 2018-04-01 22:23 +0000
Re: Technical Help Needed Urgently -- MathJax [SOLVED] "F. Russell" <fr@random.info> - 2018-04-02 09:30 +0000
Re: Technical Help Needed Urgently -- MathJax [SOLVED] -hh <recscuba_google@huntzinger.com> - 2018-04-02 07:06 -0700
Re: Technical Help Needed Urgently -- MathJax [SOLVED] Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-02 07:43 -0700
Re: Technical Help Needed Urgently -- MathJax [SOLVED] fr314159@gmail.com - 2018-04-02 08:34 -0700
Re: Technical Help Needed Urgently -- MathJax [SOLVED] -hh <recscuba_google@huntzinger.com> - 2018-04-02 11:16 -0700
Print to a .PDF file. Jeff-Relf.Me @. - 2018-03-31 10:02 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-03-31 10:30 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-01 11:38 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-01 08:51 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-01 09:31 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-01 21:23 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-01 15:19 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 07:56 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 09:08 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 08:14 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-02 08:30 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 09:40 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 08:19 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 09:22 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 10:00 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 10:30 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 11:09 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 11:30 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 10:21 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 11:17 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 11:41 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 12:15 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 12:43 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-02 21:12 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-03 08:24 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-03 16:37 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-03 10:28 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-03 11:09 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-03 20:23 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-03 15:04 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-04 00:57 +0000
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-04 06:12 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-04 13:41 +0000
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-04 10:22 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-04 11:22 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-04 12:28 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-04 13:10 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-04 13:48 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-04 15:16 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-04 21:47 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-04 16:10 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-04 16:51 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-05 00:24 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-05 11:15 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-06 09:50 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 08:35 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 08:56 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-06 10:12 -0700
Re: C/C++ == steak and potatoes. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 12:29 -0700
Re: C/C++ == steak and potatoes. fr314159@gmail.com - 2018-04-06 13:31 -0700
Re: C/C++ == steak and potatoes. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 13:45 -0700
Re: Print to a .PDF file. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-06 21:57 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 15:04 -0700
Re: Print to a .PDF file. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-06 23:07 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 16:46 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 16:54 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-07 00:12 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 19:37 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-07 02:56 +0000
Re: Print to a .PDF file. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-07 02:49 +0000
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-07 02:58 +0000
Re: Print to a .PDF file. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-07 03:06 +0000
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-07 10:00 +0000
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-06 21:42 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-07 10:17 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-07 10:29 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-07 11:29 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-07 19:44 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-07 13:09 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-07 17:46 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-07 10:53 -0700
Re: Print to a .PDF file. owl <owl@rooftop.invalid> - 2018-04-07 18:00 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-07 12:02 -0700
GigaByte arrays. Jeff-Relf.Me @. - 2018-04-07 12:26 -0700
Re: GigaByte arrays. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-08 02:44 -0700
Re: GigaByte arrays. owl <owl@rooftop.invalid> - 2018-04-08 21:05 +0000
Re: GigaByte arrays. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-08 16:20 -0700
Re: GigaByte arrays. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-08 21:02 -0700
Re: GigaByte arrays. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-09 01:28 -0700
Re: GigaByte arrays. Steve Carroll <fretwizzer@gmail.com> - 2018-04-09 08:21 -0700
Re: GigaByte arrays. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-09 08:45 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-07 19:34 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-07 13:07 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-08 06:56 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-08 17:25 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-08 22:21 -0700
Re: Print to a .PDF file. Chris Ahlstrom <OFeem1987@teleworm.us> - 2018-04-07 06:23 -0400
Re: Print to a .PDF file. Chris Ahlstrom <OFeem1987@teleworm.us> - 2018-04-06 17:58 -0400
Re: Print to a .PDF file. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-06 23:06 +0000
Re: Print to a .PDF file. Chris Ahlstrom <OFeem1987@teleworm.us> - 2018-04-07 06:17 -0400
Re: C/C++ == steak and potatoes. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-06 21:59 +0000
Re: C/C++ == steak and potatoes. Chris Ahlstrom <OFeem1987@teleworm.us> - 2018-04-06 17:56 -0400
Re: C/C++ == steak and potatoes. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-06 23:04 +0000
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-06 10:06 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-06 10:31 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-07 10:47 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-07 10:20 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-06 20:23 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-07 02:09 -0700
Re: Print to a .PDF file. Melzzzzz <Melzzzzz@zzzzz.com> - 2018-04-06 21:55 +0000
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-06 05:10 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-06 07:32 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-05 01:40 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-04 08:08 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-04 11:20 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-04 11:32 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-04 12:20 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-04 13:13 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-04 04:56 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 14:16 -0700
Re: Print to a .PDF file. chrisv <chrisv@nospam.invalid> - 2018-04-03 08:21 -0500
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-01 12:25 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-01 21:07 +0000
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-01 15:09 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 07:46 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 08:48 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-02 09:17 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 09:19 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 09:29 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 10:09 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 10:39 -0700
Re: Print to a .PDF file. fr314159@gmail.com - 2018-04-02 11:12 -0700
Re: Print to a .PDF file. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 11:23 -0700
Re: WikiPedia's "Math" options, MathML. Steve Carroll <fretwizzer@gmail.com> - 2018-04-02 12:53 -0700
Re: WikiPedia's "Math" options, MathML. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-02 23:10 -0700
Re: Print to a .PDF file. Steven Petruzzellis <frelwizzen@gmail.com> - 2018-04-01 03:04 -0700
Re: Print to a .PDF file. "F. Russell" <fr@random.info> - 2018-04-01 11:12 +0000
csiph-web