<commit_before>========================================================================
    Mandelbrot fractal generator --- SSE2 & SSE4.1 implementation
========================================================================

SSE procedure calculates 4 pixels in parallel. SSE4.1 procedure uses
``PTEST`` instruction to break loop when lengths of all 4 complex numbers
are greater then some threshold.  SSE2 version uses ``PMOVMSKB`` and x86
``TEST``.

Average speedup over FPU procedure is around 4.5 times.  Measured on
Core2 Duo E8200 @ 2.66GHz.


Compilation SSE4.1 version::

	gcc -O3 -Wall -pedantic -std=c99 sse4-mandelbrot.c -o your_favorite_name

Compilation SSE2 version::

	gcc -O3 -Wall -pedantic -std=c99 -DSSE2 sse-mandelbrot.c -o your_favorite_name<commit_msg>sse4-mandelbrot: results from core i7 and xeon<commit_after>========================================================================
    Mandelbrot fractal generator --- SSE2 & SSE4.1 implementation
========================================================================

SSE procedure calculates 4 pixels in parallel. SSE4.1 procedure uses
``PTEST`` instruction to break loop when lengths of all 4 complex numbers
are greater then some threshold.  SSE2 version uses ``PMOVMSKB`` and x86
``TEST``.

Average speedup over FPU procedure is around 4.5 times --- see below


Compilation SSE4.1 version::

	gcc -O3 -Wall -pedantic -mfpmath=387 -std=c99 sse4-mandelbrot.c -o your_favorite_name

Compilation SSE2 version::

	gcc -O3 -Wall -pedantic -mfpmath=387 -std=c99 -DSSE2 sse-mandelbrot.c -o your_favorite_name

Flag ``mfpmath=387`` is very important, because I mixed floating points
calculations with asm statements.


Results
------------------------------------------------------------------------


"FPU" procedure uses FPU instructions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Compilation::

	gcc -O3 -mfpmath=387 -std=c99 sse4-mandelbrot.c

+----------------------------------+----------------+-------------+-------------+
| CPU                              | FPU [us]       | SSE4.1 [us] | speedup [%] |
+==================================+================+=============+=============+
| Core2 Duo E8200 @ 2.66GHz        | ?              | ?           | 450         |
+----------------------------------+----------------+-------------+-------------+
| Core i7-3612QM CPU @ 2.10GHz     | 530472         | 152459      | 348         |
+----------------------------------+----------------+-------------+-------------+
| Core2 Duo E8200 @ 2.66GHz        | 1716500        | 250706      | 685         |
+----------------------------------+----------------+-------------+-------------+


"FPU" procedure uses scalar SSE instructions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Compilation::

	gcc -O3 -mfpmath=sse2 -std=c99 sse4-mandelbrot.c


+----------------------------------+----------------+-------------+-------------+
| CPU                              | FPU [us]       | SSE4.1 [us] | speedup [%] |
+==================================+================+=============+=============+
| Core i7-3612QM CPU @ 2.10GHz     | 488984         | 152459      | 320         |
+----------------------------------+----------------+-------------+-------------+
{'fraction_non_alphanumeric': 0.408994226678821, 'fraction_numerical': 0.049225159525979945, 'mean_word_length': 1.9132743362831859, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4009106', 'n_tokens_mistral': 955, 'n_tokens_neox': 801, 'n_words': 237}