<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: yusuf</title>
    <description>The latest articles on DEV Community by yusuf (@canbax).</description>
    <link>https://dev.to/canbax</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F232480%2Fd918b9de-8abf-494d-b219-ca0ea300c2cd.jpeg</url>
      <title>DEV Community: yusuf</title>
      <link>https://dev.to/canbax</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/canbax"/>
    <language>en</language>
    <item>
      <title>Can WebAssembly make your web apps faster?</title>
      <dc:creator>yusuf</dc:creator>
      <pubDate>Sun, 16 Apr 2023 17:29:10 +0000</pubDate>
      <link>https://dev.to/canbax/can-webassembly-make-your-web-apps-faster-378j</link>
      <guid>https://dev.to/canbax/can-webassembly-make-your-web-apps-faster-378j</guid>
      <description>&lt;h2&gt;
  
  
  What is WebAssembly?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Assembly?
&lt;/h3&gt;

&lt;p&gt;As we all know, machines read binary codes (strings of zeros and ones) because it is very convenient for them but not for humans. So engineers basically created a mapping from binary code and called the mapped version 'Assembly'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7lolx3sbg1oml9q1qof.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7lolx3sbg1oml9q1qof.png" alt="Assembly and binary code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  WebAssembly?
&lt;/h3&gt;

&lt;p&gt;WebAssembly is an 'Assembly'-like language. It's nickname is &lt;em&gt;wasm&lt;/em&gt;. Basically WebAssembly is the Assembly language for modern browsers. &lt;/p&gt;

&lt;p&gt;People usually don't write Assembly code directly because it can be tedious. That's why there are many Assembly compilers that simply create Assembly code from &lt;a href="https://emscripten.org/" rel="noopener noreferrer"&gt;C/C++&lt;/a&gt;, C#, Rust, Java ... So basically you can run an existing C/C++ or Rust application inside a browser.&lt;/p&gt;

&lt;p&gt;WebAssembly code can be directly injected into Javascript or Node.js environment. This can be very useful because you can combine WebAssembly with Javascript.&lt;/p&gt;

&lt;p&gt;WebAssembly provides near native performance. Javascript is just-in-time (JIT) compiled. But WebAssembly is pre-compiled. So that's why wasm can be executed faster than Javascript code. &lt;/p&gt;

&lt;h2&gt;
  
  
  Get your hands dirty
&lt;/h2&gt;

&lt;p&gt;Firstly, all the source codes used in this post available in &lt;a href="https://github.com/canbax/wasm0" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. The ultimate question in my mind is &lt;strong&gt;"Can we sort an array of integers faster with WebAssembly?"&lt;/strong&gt;. Since we want to execute faster, I think I should use the holy programming language &lt;strong&gt;C&lt;/strong&gt;. &lt;br&gt;
To compile WebAssembly, I used &lt;a href="https://emscripten.org" rel="noopener noreferrer"&gt;emscripten&lt;/a&gt; I wrote C code and compiled C code into WebAssembly using emscripten.  I simply followed instructions at &lt;a href="https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm" rel="noopener noreferrer"&gt;MDN&lt;/a&gt; and &lt;a href="https://emscripten.org/docs/getting_started/downloads.html" rel="noopener noreferrer"&gt;emscripten&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Hello World!
&lt;/h3&gt;

&lt;p&gt;After you download and install emscripten by following their documentation, you should have a &lt;code&gt;emsdk&lt;/code&gt; folder. Go into that folder and run &lt;code&gt;source ./emsdk_env.sh&lt;/code&gt;. Now you can compile your C codes into WebAssembly. To compile a hello world WebAssembly code, I used command &lt;code&gt;emcc -o hello3.html hello3.c --shell-file html_template/shell_minimal2.html -s NO_EXIT_RUNTIME=1 -s "EXPORTED_RUNTIME_METHODS=['ccall']"&lt;/code&gt;. Here &lt;code&gt;emcc&lt;/code&gt; is the emscripten compiler. &lt;code&gt;-o hello3.html hello3.c&lt;/code&gt; means compile 'hello3.c' and output HTML file 'hello3.html'. My 'hello3.c' is like below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;emscripten/emscripten.h&amp;gt;

int main() {
    printf("Hello World\n");
    return 0;
}

#ifdef __cplusplus
#define EXTERN extern "C"
#else
#define EXTERN
#endif

EXTERN EMSCRIPTEN_KEEPALIVE void myFunction(int argc, char ** argv) {
    printf("MyFunction Called\n");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It simply prints 'Hello World' to the developer console when the web page is loaded. And also prints 'MyFunction Called' when the C function is called.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--shell-file html_template/shell_minimal2.html&lt;/code&gt; of the script basically uses a template html file to generate the output 'hello3.html' file. My 'shell_minimal2.html' is like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;button id="mybutton"&amp;gt;Call the C function&amp;lt;/button&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
{{{ SCRIPT }}}
&amp;lt;script&amp;gt;
  document.getElementById("mybutton").addEventListener("click", () =&amp;gt; {
    alert("check console");
    const result = Module.ccall(
      "myFunction", // name of C function
      null, // return type
      null, // argument types
      null // arguments
    );
  });
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rest of the command is necessary to call the function using some special method called &lt;code&gt;ccal&lt;/code&gt;. If you execute the command, it will generate 'hello3.html', 'hello3.js', and 'hello3.wasm' files. If you look at 'hello3.html' you will see&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;button id="mybutton"&amp;gt;Call the C function&amp;lt;/button&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&amp;lt;script async type="text/javascript" src="hello3.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
  document.getElementById("mybutton").addEventListener("click", () =&amp;gt; {
    alert("check console");
    const result = Module.ccall(
      "myFunction", // name of C function
      null, // return type
      null, // argument types
      null // arguments
    );
  });
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only difference between the template file 'shell_minimal2.html' and 'hello3.html' is the &lt;code&gt;{{{ SCRIPT }}}&lt;/code&gt; section. Inside the 'hello3.html', this part is replaced with &lt;code&gt;&amp;lt;script async type="text/javascript" src="hello3.js"&amp;gt;&lt;/code&gt; 'hello3.js' is a Javascript file that provides a global variable named &lt;code&gt;Module&lt;/code&gt; and also imports &lt;code&gt;hello3.wasm&lt;/code&gt;. &lt;code&gt;hello3.wasm&lt;/code&gt; is a binary file. You cannot read it with naked eye easily. Start an HTTP server and open 'hello3.html' in a modern browser. I'm using VSCode for code editing and it has &lt;a href="https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer" rel="noopener noreferrer"&gt;a nice extension&lt;/a&gt; for simple HTTP server. Then you can actually see that wasm file is converted to WebAssembly Text (.wat) format in your browser.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4m3yrmn5c3j6kfe5ri3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4m3yrmn5c3j6kfe5ri3w.png" alt="WebAssembly Text representation in browser"&gt;&lt;/a&gt;&lt;br&gt;
In developer console, you can see &lt;code&gt;printf&lt;/code&gt; statements of C codes are actually printed. This is hello world for WebAssembly! Also if you click to the button, you will see it calls a C function! That's amazing! From JavaScript we can call a C function!&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfajul8nvil6i9icmddr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfajul8nvil6i9icmddr.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Fibonacci
&lt;/h3&gt;

&lt;p&gt;Now let's see if a C code can execute faster than plain Javascript code. To make a comparison I implemented fibonacci algorithm in a very inefficient way in both C and Javascript and executed side-by-side. &lt;/p&gt;

&lt;p&gt;I executed command just like hello world example &lt;code&gt;emcc -o hello4.html fib.c --shell-file html_template/simple_compare.html -sEXPORTED_FUNCTIONS=_fib -sEXPORTED_RUNTIME_METHODS=cwrap&lt;/code&gt;. Here to call a C function, we use someother special method &lt;code&gt;cwrap&lt;/code&gt;.&lt;br&gt;
Below is my C code file 'fib.c'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int fib(int n)
{
    if (n &amp;lt; 2)
        return n;
    return fib(n - 1) + fib(n - 2);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is my 'simple_compare.html' file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{{ SCRIPT }}}
&amp;lt;input type="number" id="fibNum" value="35" /&amp;gt;
&amp;lt;button id="mybutton"&amp;gt;Compare JS vs C on Fibonacci&amp;lt;/button&amp;gt;
&amp;lt;script&amp;gt;
  document.getElementById("mybutton").addEventListener("click", () =&amp;gt; {
    const fibIndex = Number(document.getElementById("fibNum").value);
    const t1 = executeFibonacciOnC(fibIndex);
    const t2 = executeFibonacciOnJS(fibIndex);
    console.log("C time:", t1, "JS time:", t2);
  });

  // finds the 'n'th fibonacci number in C using the worst implementation and returns the execution time
  function executeFibonacciOnC(n) {
    fibC = Module.cwrap("fib", "number", ["number"]);
    const t1 = performance.now();
    const res = fibC(n);
    const t2 = performance.now();
    console.log("c result: ", res);
    return t2 - t1;
  }

  function executeFibonacciOnJS(n) {
    const t1 = performance.now();
    const res = fib(n);
    const t2 = performance.now();
    console.log("JS result: ", res);
    return t2 - t1;
  }

  function fib(n) {
    if (n &amp;lt; 2) return n;
    return fib(n - 1) + fib(n - 2);
  }
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here you can see that Javascript is a lot faster than C code. I feel like I wasted all my time and WebAssembly is just a balloon. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferqc5tbt7s7eqk6crf20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferqc5tbt7s7eqk6crf20.png" alt="C vs JS on Fibonacci calculation without any compiler optimizations"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then I realized there is some compiler optimization flags in emscripten. Let's use them &lt;code&gt;emcc -o hello4.html fib.c --shell-file html_template/simple_compare.html -sEXPORTED_FUNCTIONS=_fib -sEXPORTED_RUNTIME_METHODS=cwrap -O2&lt;/code&gt; I just added a &lt;code&gt;-O2&lt;/code&gt; flag to my command and do it again.&lt;/p&gt;

&lt;p&gt;Now you can see some magic!&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbho7fjsubsgcjr2kgtiv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbho7fjsubsgcjr2kgtiv.png" alt="C vs JS on Fibonacci calculation with O2 compiler optimization flag"&gt;&lt;/a&gt;&lt;br&gt;
This time, C code executes faster! In some cases it is like even 2 times faster!&lt;/p&gt;
&lt;h3&gt;
  
  
  Sort numbers
&lt;/h3&gt;

&lt;p&gt;Now let's try our ultimate aim. Can we sort numbers faster than Javascript? Let's try with C standard library function &lt;code&gt;qsort&lt;/code&gt; I think it should be faster, C codes are usually fast. Similar to previous command, I executed command &lt;code&gt;emcc -o qsort.html arraySorter.c --shell-file html_template/simple_compare_array.html -sEXPORTED_FUNCTIONS=_arraySorter,_malloc,_free -sEXPORTED_RUNTIME_METHODS=cwrap&lt;/code&gt; My 'arraySorter.c' is very simple like below. It simply calls &lt;code&gt;qsort&lt;/code&gt; function with a comparer function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdlib.h&amp;gt;

int compareFn(const void *a, const void *b)
{
    return (*(int *)a - *(int *)b);
}

void arraySorter(int *arr, int size)
{
    qsort(arr, size, sizeof(int), compareFn);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My template file 'simple_compare_array.html' is like below. Here passing and array as a parameter is bit hard. We need to use &lt;code&gt;malloc&lt;/code&gt; and &lt;code&gt;free&lt;/code&gt; functions to create and array and pass it to C.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{{ SCRIPT }}}
&amp;lt;input type="number" id="arrSize" value="1000000" /&amp;gt;
&amp;lt;button id="mybutton"&amp;gt;Compare JS vs C on sorting integer array&amp;lt;/button&amp;gt;
&amp;lt;script&amp;gt;
  function getArray() {
    const l = Number(document.getElementById("arrSize").value);
    return Array.from({ length: l }, () =&amp;gt; Math.floor(Math.random() * l));
  }
  document.getElementById("mybutton").addEventListener("click", () =&amp;gt; {
    const arr1 = getArray();
    const arr2 = Array.from(arr1);
    const t1 = arrayOperationsOnC(arr1);
    const t2 = arrayOperationsOnJS(arr2);
    console.log("C time:", t1, "JS time:", t2);
  });

  function arrayOperationsOnC(n) {
    const BYTE_SIZE_OF_INT = 4;
    const t1 = performance.now();
    const arraySize = n.length;
    const arrayPointer = Module._malloc(arraySize * BYTE_SIZE_OF_INT);
    Module.HEAP32.set(new Int32Array(n), arrayPointer / BYTE_SIZE_OF_INT);
    const cFunc = Module.cwrap("arraySorter", null, ["number", "number"]);
    cFunc(arrayPointer, arraySize);
    const resultArray = Array.from(
      Module.HEAP32.subarray(
        arrayPointer / BYTE_SIZE_OF_INT,
        arrayPointer / BYTE_SIZE_OF_INT + arraySize
      )
    );
    console.log(resultArray);
    Module._free(arrayPointer);
    const t2 = performance.now();
    return t2 - t1;
  }

  function arrayOperationsOnJS(n) {
    const t1 = performance.now();
    const res = arraySorter(n);
    console.log(res);
    const t2 = performance.now();
    return t2 - t1;
  }

  function arraySorter(arr) {
    return arr.sort((a, b) =&amp;gt; a - b);
  }
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I execute this I see my C code is like 4 times slower! &lt;br&gt;
What the heck is wrong?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4ifpm66r66d216qrhb8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz4ifpm66r66d216qrhb8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OK I see I didn't use compiler optimization flags. Let's try &lt;code&gt;-O2&lt;/code&gt; flag and do it again. Now it is faster but still very slower than Javascript.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;C time: 716.1 JS time: 269.5&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Even if I use &lt;code&gt;-O3&lt;/code&gt; flag, I see it is still slower. There is no '-O4' this is the most optimized.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;C time: 711.9 JS time: 270.6&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now we are sure that quick sort with C cannot pass plain Javascript. But we used C standard library function &lt;code&gt;qsort&lt;/code&gt;. Can we try plain C code for quick sort? Let's try. I used command &lt;code&gt;emcc -o faster_sorter.html arraySorter2.c --shell-file html_template/simple_compare_array.html -sEXPORTED_FUNCTIONS=_arraySorter,_malloc,_free -sEXPORTED_RUNTIME_METHODS=cwrap -O2&lt;/code&gt; Here I used the same HTML template but this time I implemented quick sort algorithm with plain C code. Below in my &lt;code&gt;arraySorter2.c&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Quick sort in C

// function to swap elements
void swap(int *a, int *b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

// function to find the partition position
int partition(int array[], int low, int high)
{

    // select the rightmost element as pivot
    int pivot = array[high];

    // pointer for greater element
    int i = (low - 1);

    // traverse each element of the array
    // compare them with the pivot
    for (int j = low; j &amp;lt; high; j++)
    {
        if (array[j] &amp;lt;= pivot)
        {

            // if element smaller than pivot is found
            // swap it with the greater element pointed by i
            i++;

            // swap element at i with element at j
            swap(&amp;amp;array[i], &amp;amp;array[j]);
        }
    }

    // swap the pivot element with the greater element at i
    swap(&amp;amp;array[i + 1], &amp;amp;array[high]);

    // return the partition point
    return (i + 1);
}

void quickSort(int array[], int low, int high)
{
    if (low &amp;lt; high)
    {

        // find the pivot element such that
        // elements smaller than pivot are on left of pivot
        // elements greater than pivot are on right of pivot
        int pi = partition(array, low, high);

        // recursive call on the left of pivot
        quickSort(array, low, pi - 1);

        // recursive call on the right of pivot
        quickSort(array, pi + 1, high);
    }
}

void arraySorter(int *arr, int size)
{
    quickSort(arr, 0, size - 1);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now it seems with &lt;code&gt;-O2&lt;/code&gt; flag we can sort integers faster than plain Javascript! Now C code is like 2 times faster. That's amazing!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;C time: 156.8 JS time: 271.5&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Is Wasm faster in your browser? &lt;a href="https://canbax.github.io/wasm0/" rel="noopener noreferrer"&gt;Try and see&lt;/a&gt; now. All the &lt;a href="https://github.com/canbax/wasm0" rel="noopener noreferrer"&gt;source codes&lt;/a&gt; is available under MIT license.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webassembly</category>
      <category>c</category>
    </item>
    <item>
      <title>İnternette gezerken dünyayı kurtar!</title>
      <dc:creator>yusuf</dc:creator>
      <pubDate>Mon, 20 Jun 2022 13:56:26 +0000</pubDate>
      <link>https://dev.to/canbax/internette-gezerken-dunyayi-kurtar-38ne</link>
      <guid>https://dev.to/canbax/internette-gezerken-dunyayi-kurtar-38ne</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/canbax/save-the-world-while-browsing-the-internet-kko"&gt;English translation&lt;/a&gt;&lt;br&gt;
İnternetin yaygınlaşması ile insanlar hemen hemen her gün dünyayı saran bu kablolu/kablosuz ağda gezinmeye başladı. Küçükken internetin Google olduğunu zannederdim 😁 ancak büyüyüp mühendis olunca "internet tarayıcısı" denilen programlar ve "arama motoru" denilen internet siteleri sayesinde internette gezdiğimi fark ettim.  &lt;/p&gt;

&lt;p&gt;Google Chrome, Safari, Microsoft Edge, Mozilla Firefox, Opera ... gibi programlar popüler internet tarayıcılarıdır. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uDop4TdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w41ihqfcpki2nam98q34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uDop4TdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w41ihqfcpki2nam98q34.png" alt="Yaygın internet tarayıcılarının logoları" width="800" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google, Bing, Baidu, Yahoo!, Yandex ... gibi internet siteleri ise yaygın arama motorlarıdır. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qkt5_vpn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjzb6jdc8ctj0a2lnz6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qkt5_vpn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjzb6jdc8ctj0a2lnz6h.png" alt="Yaygın arama motorlarının logoları" width="600" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;İnternet tarayıcılarının ve arama motorlarının çoğu (yukarıda örnek verilenlerin hepsi) ücretsiz olduğu halde reklam alarak milyar dolar mertebelerinde gelirler elde edebiliyorlar. Bunu kullancılarının yaptıkları aramaların ve kişisel bilgilerin kayıtlarını tutup çeşitli algoritmalar kullanarak başarıyorlar. Örneğin Google 2021 yılında &lt;a href="https://www.statista.com/statistics/266206/googles-annual-global-revenue/"&gt;200 milyar dolardan fazla&lt;/a&gt; reklam geliri elde etmiştir.&lt;/p&gt;

&lt;h1&gt;
  
  
  Ecosia
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.ecosia.org"&gt;Ecosia&lt;/a&gt; da tıpkı Google gibi bir arama motoru. Google'dan farklı olarak Ecosia elde ettiği tüm net kârını ağaç dikmek için harcadığını iddia ediyor. Bu şirketle herhangi bir alakam yok ve bir güvenilirlik garantisi de veremem. Yaklaşık 1-2 yıldır Ecosia'yı kullanıyorum ve genel olarak memnunum. Ecosia'ya güveniyorum çünkü şeffaf bir yapıları var, &lt;a href="https://blog.ecosia.org/ecosia-financial-reports-tree-planting-receipts/"&gt;finansal raporları&lt;/a&gt; ve &lt;a href="https://twitter.com/Ecosia"&gt;sosyal medya gönderileri&lt;/a&gt; bana ikna edici geldi.&lt;/p&gt;

&lt;h2&gt;
  
  
  Neden Ecosia kullanıyorum?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Kişisel veri toplamıyor. Ecosia Google gibi daha önceden yapılan aramaların kayıtlarını tutmuyor. Tamamen aradığım sözcüklere göre sonuçları getiriyor. Bu hem kişisel verilerinizi korumanızı hem de daha ilgili sonuçlar bulmanızı sağlıyor.&lt;/li&gt;
&lt;li&gt;Çok daha az reklam gösteriyor.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9aSJn07t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ostzz73lym2shjykqc1i.png" alt="&amp;quot;adrasan tatil&amp;quot; ifadesine Ecosia ve Google'ın çıkardığı sonuçlar. Ecosia reklam göstermiyor, Google 4 tane." width="800" height="506"&gt;
&lt;/li&gt;
&lt;li&gt;Sadece girilen yazıyı baz alıp arama yaptığından daha popüler olanı değil daha alakalı olanı görüyorsunuz. Google'ın &lt;a href="https://en.wikipedia.org/wiki/PageRank"&gt;PageRank isimli meşhur algoritması&lt;/a&gt; zaten popüler sonuçları üste çıkarmayı hedeflemektedir.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Koskoca Google'dan daha mı iyi yani?
&lt;/h3&gt;

&lt;p&gt;Son olarak Google'ın da üstün geldiği taraflar olabilir. Mesela birşey satın almak istiyorsanız Google satın almak istediğiniz ürünlere çok daha iyi ulaşım sağlıyor. Google'ın harita hizmeti de oldukça iyi. Tabi bazen Google daha alakalı sonuçlar da gösterebiliyor.&lt;/p&gt;

&lt;p&gt;Son olarak Ecosia'nın &lt;a href="https://info.ecosia.org/mobile"&gt;mobil uygulaması&lt;/a&gt; yani mobil cihazlarda çalışan internet tarayıcısı da var. Ben biraz kullandım ama açıkçası başka tarayıcıları daha çok beğendiğimden kullanmadım.&lt;/p&gt;

&lt;p&gt;Ayrıca Ecosia ile yaptığınız arama sayısını kayıt edebilirsiniz. Ben telefonum ile 1400'den fazla, bilgisayar ile ise 2700'den fazla arama yapmışım. Bu sayıları ne kadar doğru tutuyorlar açıkçası pek emin değilim.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sBTYj7Ry--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tenuppg9p2g5jdnjrr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sBTYj7Ry--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tenuppg9p2g5jdnjrr0.png" alt="Ecosia'da yaptığım arama sayıları" width="682" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  OceanHero
&lt;/h1&gt;

&lt;p&gt;İnternet tarayıcınızda boş bir sekme açtığınızda ne göreceğinizi özelleştirebilirsiniz. &lt;a href="https://oceanhero.today/"&gt;OceanHero&lt;/a&gt; size reklam gösterip, reklam gelirleri ile okyanuslardaki plastik atıkları temizlediğini iddia ediyor. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3EdwvXaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xdyiq2xlwtqc28fl06c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3EdwvXaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xdyiq2xlwtqc28fl06c.png" alt="Boş sekmede gösterilen OceanHero reklamları" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;İşleyişin nasıl olduğunu &lt;a href="https://www.youtube.com/watch?v=Un3kQ0abA7M"&gt;1 dakikalık kısa ve açıklayıcı bir video&lt;/a&gt; ile anlatmışlar. &lt;/p&gt;

&lt;p&gt;Ayrıca OceanHero'da &lt;a href="https://oceanhero.today/search"&gt;bir arama motoru hizmeti&lt;/a&gt; de sunuyor. Çok fazla kullanmadığım için pek yorum yapamayacağım ancak okyanus modunun ("Ocean Mode") çok hoş göründüğünü söyleyebilirim.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IqO59MDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/htddjt5ld8epplx0fzev.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IqO59MDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/htddjt5ld8epplx0fzev.jpg" alt="OceanHero'da okyanus modunda yapılan bir arama" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Brave
&lt;/h1&gt;

&lt;p&gt;Bu kez ekoloji ile alakası olmayan bir araçtan bahsedeceğim. &lt;a href="https://brave.com"&gt;Brave&lt;/a&gt; bir internet tarayıcısı. Gezegenimizin fiziksel olarak yaşanılabilir olmasına direk bir katkısı olmasa da Brave mahremiyete verdiği büyük önem sayesinde dijital hayatın yaşanılabilirliğine büyük katkı sağlıyor. Son dönemde Google, Facebook, Microsoft gibi dev şirketler de mahremiyeti gündemlerine taşıyıp bu konuda daha çok efor sarf etmeye başladılar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Neden Brave kullanıyorum?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Reklam ve izleyicileri blokluyor. Bazı siteler sizin reklam engelleyicisi kullandığınızı söyleyip size içerik göstermeyebilir. Bu durumda "kalkanlarınızı" indirerek reklam ve izleyicilere izin verebilirsiniz.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tabletimde kullandığım Brave 1-2 yıllık süreçte 2 GB'lık veri, 1 saatlik ise zaman tasarrufu sağladığını iddia ediyor.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XwPu6ePv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fw0i50xmxec0qye6zlhd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XwPu6ePv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fw0i50xmxec0qye6zlhd.jpg" alt="Tabletimde kullandığım Brave'in tuttuğu istatistikler" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Telefonumda kullandığım Brave ise 3.8 GB'lık veri, 1 saatlik zaman tasarrufu sağladığını iddia ediyor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iwYqCt81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6l9wuo2452u3mtmg7a7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iwYqCt81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6l9wuo2452u3mtmg7a7.jpg" alt="Telefonumda kullandığım Brave'in tuttuğu istatistikler" width="720" height="1280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Eğer YouTube'u kullanıyorsanız bundan çok daha fazla zaman tasarrufu yapacağınıza gayet eminim. YouTube'un resmi uygulamasını kullanmaktansa Brave ile YouTube'u kullanıyorum çünkü yıllardır YouTube'da reklam izlemiyorum. (Evet, YouTube Premium'a boşa para veriyorlar :) &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Daha hızlı. Google Chrome'dan bile daha mı hızlı gerçekten? Bence evet. Çok ciddi ölçümler yapmadım ama reklam ve izleyicileri engellediğinden daha hızlı olması da gayet normal aslında. Brave kullanırken Google Chrome'dan daha hızlı olduğunu açıkça hissediyorum ancak tabiki mühendisler hisleriyle hareket etmemeliler. Brave Google Chrome'dan &lt;a href="https://brave.com/compare/chrome/performance/"&gt;3 kata kadar daha hızlı&lt;/a&gt; olabileceğini iddia ediyor.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Açık kaynak kodlu. Kodları okuyup tekrar yazmayacak olsanız bile bunu yapabilmeniz ya da başka geliştiricilere yaptırabilmeniz güzel bir imkan. Fazla imkan göz çıkarmaz.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;"BAT" tokeni kazanabilirsiniz. İsterseniz Brave ile bazı reklamlara maruz kalıp "BAT" kripto varlığını edinebilirsiniz. Brave gösterilen reklamların mahremiyete önem verdiğini iddia ediyor. Hiç reklam görmemek bana cazip geldiğinden bundan pek yararlanmadım.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Brave hakkında son olarak ilginç bir bilgi verelim. Brave'in CEO'su &lt;a href="https://tr.wikipedia.org/wiki/Brendan_Eich"&gt;Brendan Eich&lt;/a&gt; JavaScript dilinin yaratıcısı ve Mozilla'nın kurucularındandır.&lt;/p&gt;

&lt;p&gt;Son olarak burada bahsettiğim şirketlerin herhangi biri tarafından finansal bir destek almadım. Herhangi biriyle çalışmıyorum. Brave, OceanHero ya da Ecosia hakkında herhangi bir garanti veremem. Bunları sadece beğeniyorum ve kullanıyorum.&lt;/p&gt;

</description>
      <category>aramamotoru</category>
      <category>internet</category>
    </item>
    <item>
      <title>Save the world while browsing the internet!</title>
      <dc:creator>yusuf</dc:creator>
      <pubDate>Mon, 20 Jun 2022 13:56:07 +0000</pubDate>
      <link>https://dev.to/canbax/save-the-world-while-browsing-the-internet-kko</link>
      <guid>https://dev.to/canbax/save-the-world-while-browsing-the-internet-kko</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/canbax/internette-gezerken-dunyayi-kurtar-38ne"&gt;Türkçe çevirisi&lt;/a&gt;&lt;br&gt;
With the widespread use of the Internet, people started to browse this wired/wireless network that surrounds the world almost every day. When I was little, I thought the internet was Google 😁 but when I grew up and became an engineer, I realized that I was surfing the internet thanks to programs called "internet browser" and websites called "search engines".&lt;/p&gt;

&lt;p&gt;Programs such as Google Chrome, Safari, Microsoft Edge, Mozilla Firefox, Opera ... are popular internet browsers.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uDop4TdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w41ihqfcpki2nam98q34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uDop4TdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w41ihqfcpki2nam98q34.png" alt="Common internet browsers logos" width="800" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Internet sites such as Google, Bing, Baidu, Yahoo!, Yandex ... are common search engines.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qkt5_vpn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjzb6jdc8ctj0a2lnz6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qkt5_vpn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjzb6jdc8ctj0a2lnz6h.png" alt="Logos of common search engines" width="600" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although most internet browsers and search engines (all of the examples above) are free, they can earn billions of dollars by advertising. They achieve this by keeping records of their users' searches and personal information, using various algorithms. For example, Google generated &lt;a href="https://www.statista.com/statistics/266206/googles-annual-global-revenue/"&gt;more than $200 billion&lt;/a&gt; ad revenue in 2021.&lt;/p&gt;

&lt;h1&gt;
  
  
  Ecosia
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.ecosia.org"&gt;Ecosia&lt;/a&gt; is a search engine just like Google. Unlike Google, Ecosia claims to spend all its net profits on planting trees. I have no affiliation with this company and I cannot give any guarantee of reliability. I have been using Ecosia for about 1-2 years and I am generally satisfied. I trust Ecosia because they have a transparent structure, &lt;a href="https://blog.ecosia.org/ecosia-financial-reports-tree-planting-receipts/"&gt;financial reports&lt;/a&gt; and &lt;a href="https://twitter%20.com/Ecosia"&gt;social media posts&lt;/a&gt; sounded convincing to me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do I use Ecosia?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It does not collect personal data. Ecosia does not keep logs of previous searches like Google. It returns results exactly based on the words I'm looking for. This allows you to both protect your personal data and find more relevant results.&lt;/li&gt;
&lt;li&gt;It shows a lot less ads.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9aSJn07t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ostzz73lym2shjykqc1i.png" alt="Ecosia and Google's results for the expression &amp;quot;adrasan holiday&amp;quot;. Ecosia doesn't show ads, Google has 4." width="800" height="506"&gt;
&lt;/li&gt;
&lt;li&gt;You only see what's more relevant, not what's more popular, as you search based on the entered text. Google's &lt;a href="https://en.wikipedia.org/wiki/PageRank"&gt;famous algorithm named PageRank&lt;/a&gt; aims to top the already popular results.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Is it really better than all mighty GOOGLE?
&lt;/h3&gt;

&lt;p&gt;Finally, there may be parties where Google excels. For example, if you want to buy something, Google provides much better access to the products you want to buy. Google's map service is pretty good too. Of course, sometimes Google can show more relevant results.&lt;/p&gt;

&lt;p&gt;Finally, there is Ecosia's &lt;a href="https://info.ecosia.org/mobile"&gt;mobile application&lt;/a&gt;, that is, an internet browser that works on mobile devices. I used a little bit, but frankly, I didn't use it because I like other browsers more.&lt;/p&gt;

&lt;p&gt;You can also record the number of calls you make with Ecosia. I made more than 1400 searches with my phone and more than 2700 searches with my computer. Honestly, I'm not sure how accurate these numbers are.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sBTYj7Ry--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tenuppg9p2g5jdnjrr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sBTYj7Ry--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tenuppg9p2g5jdnjrr0.png" alt="The number of searches I made on Ecosia" width="682" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  OceanHero
&lt;/h1&gt;

&lt;p&gt;You can customize what you see when you open a blank tab in your internet browser. &lt;a href="https://oceanhero.today/"&gt;OceanHero&lt;/a&gt; claims to be showing you ads and clearing plastic waste from the oceans with ad revenue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3EdwvXaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xdyiq2xlwtqc28fl06c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3EdwvXaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xdyiq2xlwtqc28fl06c.png" alt="OceanHero ads showing in blank tab" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They explained how it works with &lt;a href="https://www.youtube.com/watch?v=Un3kQ0abA7M"&gt;a 1-minute short and explanatory video&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It also offers &lt;a href="https://oceanhero.today/search"&gt;a search engine service&lt;/a&gt; on OceanHero. I can't comment much since I don't use it much, but I can say that the ocean mode ("Ocean Mode") looks very nice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IqO59MDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/htddjt5ld8epplx0fzev.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IqO59MDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/htddjt5ld8epplx0fzev.jpg" alt="A search in OceanHero in ocean mode" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Brave
&lt;/h1&gt;

&lt;p&gt;This time I will talk about a tool that has nothing to do with ecology. &lt;a href="https://brave.com"&gt;Brave&lt;/a&gt; is an internet browser. Although it does not directly contribute to the physical livability of our planet, Brave makes a great contribution to the livability of digital life thanks to the great importance it gives to privacy. Recently, giant companies such as Google, Facebook and Microsoft have also brought privacy to their agenda and started to make more effort in this regard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why am I using Brave?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Blocks advertisements and trackers. Some sites may say that you are using an ad-blocker and not show you any content. In this case, you can disable your "shields" and allow ads and trackers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Brave, which I use on my tablet, claims to save 2 GB of data and 1 hour of time in 1-2 years.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XwPu6ePv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fw0i50xmxec0qye6zlhd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XwPu6ePv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fw0i50xmxec0qye6zlhd.jpg" alt="Statistics kept by Brave on my tablet" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Brave, which I use on my phone, claims to save 3.8 GB of data and 1 hour of time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iwYqCt81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6l9wuo2452u3mtmg7a7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iwYqCt81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6l9wuo2452u3mtmg7a7.jpg" alt="Statistics kept by Brave on my phone" width="720" height="1280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're using YouTube, I'm pretty sure you'll save a lot more time. Rather than using YouTube's official app, I use YouTube with Brave because I haven't watched YouTube ads for years. (Yes, they are wasting money on YouTube Premium :)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Faster. Is it really even faster than Google Chrome? I think yes. I didn't make very serious measurements, but it is quite normal that it is faster as it blocks ads and trackers. When using Brave, I clearly feel that it is faster than Google Chrome, but of course, engineers should not act based on their feelings. Brave claims it can be &lt;a href="https://brave.com/compare/chrome/performance/"&gt;up to 3x faster&lt;/a&gt; than Google Chrome.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open source code. Even if you're not going to read and rewrite the code, it's a nice opportunity to be able to do it or have other developers do it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can earn "BAT" token. If you want, you can get the "BAT" crypto-asset by being exposed to some advertisements with Brave. Brave claims that the ads shown are privacy-respecting. I didn't get much use out of it as I was tempted to not see any ads.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, let's give some interesting information about Brave. Brave's CEO &lt;a href="https://en.wikipedia.org/wiki/Brendan_Eich"&gt;Brendan Eich&lt;/a&gt; is the creator of the JavaScript language and co-founder of Mozilla.&lt;/p&gt;

&lt;p&gt;Finally, I have not received any financial support from any of the companies mentioned here. I am not working with anyone. I cannot make any warranties about Brave, OceanHero or Ecosia. I just like and use them.&lt;/p&gt;

</description>
      <category>browser</category>
      <category>searchengine</category>
    </item>
    <item>
      <title>Visualizing TigerGraph &amp; Neo4j databases with "Davraz"</title>
      <dc:creator>yusuf</dc:creator>
      <pubDate>Sun, 12 Jun 2022 11:12:51 +0000</pubDate>
      <link>https://dev.to/canbax/visualizing-tigergraph-neo4j-databases-with-davraz-296d</link>
      <guid>https://dev.to/canbax/visualizing-tigergraph-neo4j-databases-with-davraz-296d</guid>
      <description>&lt;p&gt;In this post, I will introduce &lt;a href="https://github.com/canbax/davraz"&gt;Davraz&lt;/a&gt;, a software I created. Firstly, it is deployed on &lt;a href="https://canbax.github.io/davraz/"&gt;https://canbax.github.io/davraz/&lt;/a&gt;. So you can see it in action now. &lt;/p&gt;

&lt;p&gt;This post aims to introduce graph visualization to non-technical people.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Davraz&lt;/em&gt; is a &lt;a href="https://en.wikipedia.org/wiki/Graph_database"&gt;graph database&lt;/a&gt; visualizer. Currently it supports only &lt;a href="https://www.tigergraph.com/"&gt;TigerGraph&lt;/a&gt; and &lt;a href="https://neo4j.com/"&gt;Neo4j&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;I created &lt;em&gt;Davraz&lt;/em&gt; for &lt;a href="https://tigergraph2020.devpost.com/"&gt;TigerGraph 2020 Graphathon&lt;/a&gt;. (It got 1st Place Reward YAAAY!) It is a tool for visualizing your &lt;a href="https://www.tigergraph.com/"&gt;TigerGraph&lt;/a&gt; and &lt;a href="https://neo4j.com/"&gt;Neo4j&lt;/a&gt; databases. TigerGraph and Neo4j are &lt;a href="https://en.wikipedia.org/wiki/Graph_database"&gt;graph databases&lt;/a&gt;. Usually,  data is stored in SQL databases. Graph databases are a fairly new way to store data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Graph Database?
&lt;/h2&gt;

&lt;p&gt;In SQL databases, if your data is highly connected, querying data might be time-consuming (due to &lt;a href="https://www.w3schools.com/sql/sql_join.asp"&gt;join&lt;/a&gt; operations). In this case, using a graph database might considerably decrease execution time. This depends on how the graph database is implemented at its core. &lt;a href="https://www.w3schools.com/SQL/sql_ref_index.asp"&gt;Creating index&lt;/a&gt; in SQL database will also help you execute faster. At its core, creating an index is actually like creating a graph data structure. So we can say SQL is also benefiting from graphs for faster execution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Graph Visualization?
&lt;/h2&gt;

&lt;p&gt;Visualizing data is one of the most effective ways of understanding data. Graphs are a pretty generic data structure and almost any data can be defined as a graph. So visualizing graphs can be a very generic and effective way to understand any data. Graph visualization can be used for insightful analysis and interpretation. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3AEfpj08--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzr3ttjxcg59t2rc8czj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3AEfpj08--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzr3ttjxcg59t2rc8czj.png" alt="A sample graph visualization with a rich style from my MS thesis" width="800" height="732"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Set-up for TigerGraph
&lt;/h2&gt;

&lt;p&gt;From &lt;a href="https://tgcloud.io/"&gt;https://tgcloud.io/&lt;/a&gt; you can jump-start creating your own free TigerGraph database. It is very easy, you just need to click "next" etc... But you can find &lt;a href="https://medium.com/swlh/getting-started-with-tigergraph-3-0-4aac0ca4fb3d"&gt;more guidance&lt;/a&gt; on the Internet. For visualization, you can also use their embedded system called &lt;em&gt;"Graph Studio"&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;After you have a running TigerGraph instance, you can start visualizing it on &lt;em&gt;Davraz&lt;/em&gt;. If you open &lt;a href="https://canbax.github.io/davraz/"&gt;https://canbax.github.io/davraz/&lt;/a&gt;, at first you should enter database configuration data. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7AawqL20--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/np9mrd39yqofdunz5yx4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7AawqL20--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/np9mrd39yqofdunz5yx4.png" alt="First opening of Davraz" width="800" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need to provide "Database URL", "Graph Name", "Database username", and "Database password" fields. After that, if you click to "Generate Token" button, you are ready to go.&lt;/p&gt;

&lt;p&gt;You do &lt;strong&gt;NOT&lt;/strong&gt; need to change "Proxy Server URL" if you don't want to use your own proxy. &lt;/p&gt;

&lt;p&gt;If your "Database URL" is wrong or if the TigerGraph instance is not active, you might get an error like the below &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4EGIrcQo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/je3yqm1eaekwxzo74u4y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4EGIrcQo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/je3yqm1eaekwxzo74u4y.png" alt="TigerGraph instance is not active error message screenshot" width="549" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might get errors like the below if you don't provide the correct username, password, or graph name.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y5YhSg0K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kv6w9zw9wr2gfqnujj3e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y5YhSg0K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kv6w9zw9wr2gfqnujj3e.png" alt="username or password is wrong error message screenshot" width="548" height="123"&gt;&lt;/a&gt; &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SPsh2p13--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2o4uox05z6tfitu4qcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SPsh2p13--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2o4uox05z6tfitu4qcz.png" alt="Graph name is wrong error message screenshot" width="555" height="102"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If there is no error, you are good to GO! Below is a video showing how it works. Also, note that certain operations might require &lt;strong&gt;"database secret"&lt;/strong&gt;. So you should provide or generate the secret of your TigerGraph database as well.&lt;/p&gt;


  


&lt;p&gt;Also, note that the proxy server (&lt;a href="https://tiger-api.herokuapp.com/"&gt;https://tiger-api.herokuapp.com/&lt;/a&gt;) might be down for some reason. (It is a free instance) So just refreshing it might help in some cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set-up for Neo4j
&lt;/h2&gt;

&lt;p&gt;If you use Davraz from the GitHub deployment (&lt;a href="https://canbax.github.io/davraz/"&gt;https://canbax.github.io/davraz/&lt;/a&gt;), you need to serve your Neo4j API from HTTPS. This is because you cannot communicate with an HTTP server from an HTTPS server. Setting up an HTTPS server and setting up the SSL policy seems a bit tedious for me. For this reason, I will run a local version of Davraz on my own machine with HTTP. And also a local Neo4j server again from my own machine with HTTP. Inside Neo4j settings, I set &lt;code&gt;dbms.security.auth_enabled=false&lt;/code&gt; so I can make HTTP requests and get a response without providing any username and password.&lt;/p&gt;

&lt;p&gt;Below are my settings to connect to my local Neo4j instance. The database URL is &lt;strong&gt;&lt;a href="http://localhost:7474/db/data/transaction/commit"&gt;http://localhost:7474/db/data/transaction/commit&lt;/a&gt;&lt;/strong&gt;. Username and password are not necessary, they can be empty.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8TAlP7ns--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ickc2ic48nacavn28gr8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8TAlP7ns--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ickc2ic48nacavn28gr8.png" alt="Settings for a Neo4j instance" width="738" height="580"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From below video, you can see how you can visualize Neo4j data.&lt;/p&gt;


  


&lt;p&gt;Here you might see a strange view if the styles are not the default styles. See the below image for example. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dCcF4Euh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2q1fqdo5jjitg3u52tox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dCcF4Euh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2q1fqdo5jjitg3u52tox.png" alt="Graph with incompatible styles" width="800" height="696"&gt;&lt;/a&gt;&lt;br&gt;
To use default graph styles, you can click to &lt;em&gt;"File"&lt;/em&gt;&amp;gt;&lt;em&gt;"Clear Graph Style"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Like TigerGraph, Neo4j also provides free cloud instances. &lt;a href="https://neo4j.com/cloud/platform/aura-graph-database/"&gt;Neo4j AuraDB&lt;/a&gt; looks very cool and nice as well. Up to 50k nodes and 175k edges, it is free. Also, it has a nice visualizer called &lt;em&gt;"Bloom"&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;p&gt;From &lt;em&gt;"File"&lt;/em&gt; menu, you can save a graph as JSON file, load back from the file. You can save only the selected elements. You can export graph as an image. You can load different &lt;a href="https://js.cytoscape.org/#style"&gt;graph styles&lt;/a&gt;.&lt;/p&gt;


  


&lt;p&gt;From &lt;em&gt;"Edit"&lt;/em&gt; menu, you can delete selected elements, hide selected elements, show all the previously hidden elements and observe a history of graph states.&lt;/p&gt;


  


&lt;p&gt;From &lt;em&gt;"Data"&lt;/em&gt; menu, you can clear all the data or bring a sample data.&lt;/p&gt;


  


&lt;p&gt;From &lt;em&gt;"Layout"&lt;/em&gt; menu, you can run an incremental or randomized layout. There are many different layout types but the default is &lt;a href="https://github.com/iVis-at-Bilkent/cytoscape.js-fcose"&gt;fCoSE&lt;/a&gt; algorithm.&lt;/p&gt;


  


&lt;p&gt;From &lt;em&gt;"Highlight"&lt;/em&gt; menu, elements can be emphasized to distinguish from others.&lt;/p&gt;


  


&lt;p&gt;From &lt;em&gt;"Compound"&lt;/em&gt; menu, compound elements can be created or removed.&lt;/p&gt;


  


&lt;p&gt;From &lt;em&gt;"Table"&lt;/em&gt; menu, whole data or a part of the existing data can be shown as table(s).&lt;/p&gt;


  


&lt;p&gt;From &lt;em&gt;"Cluster"&lt;/em&gt; menu, you can run "Markov Clustering" algorithm or cluster degree-1 nodes.&lt;/p&gt;


  


</description>
      <category>neo4j</category>
      <category>tigergraph</category>
      <category>visualization</category>
      <category>angular</category>
    </item>
  </channel>
</rss>
