title: B Trees and Sparse Index Algorithm in C# and JavaScript
body: <h1>TLDR;</h1>
  
  <p>Can you target disk blocks when writing to disk in JavaScript or C#. Does it matter when you have SSDs.</p>
  
  <h1>Problem</h1>
  
  <p>I'm creating a BTree implementation in JavaScript and C#.</p>
  
  <p>In reading <a href="https://en.wikipedia.org/wiki/B-tree#Technical_description" rel="nofollow noreferrer">this section of wikipedia on btrees</a> it talks about sparse indexes and lowering disk reads.</p>
  
  <p>It appears to me that it is talking about grouping indexes and records into disk blocks to speed up reading them.</p>
  
  <h1>Questions</h1>
  
  <p>I have several questions:</p>
  
  <ol>
  <li><p>Can C# or JavaScript (Node) target disk blocks, or is that something you have to calculate in your code? I.e. work out using the partition tables of the HDD to figure out the block size and chunk data accordingly?</p></li>
  <li><p>Does disk block reads matter so much when we have SSDs.</p></li>
  </ol>
  
  <h1>Follow Up</h1>
  
  <p>Obviously in C# you can create <code>FileStream</code>s and <code>BinaryWriter</code>s or <code>StreamWriter</code>s, but they only take <code>byte[]</code>, you can't specify anywhere in particular on the disk - and to be honest, I expect much of writing to the disk is handled in the lower levels - like kernel and disk drivers.... </p>
  
  <p>Reading with SSDs makes everything soooo much faster, so effectively, as long as the BTree nodes kept a reference to the exact file and byte marker (or something similar) then specifying that in C# would be easy - and lightening quick anyway. It would be a simple <code>reader.Seek(/** some offset **/)</code> and then just read in the record.</p>
  
  <p>I wouldn't even know where to begin to try this with Node, it just has its simple <code>fs.writeFile()</code> function....</p>