Changes between Initial Version and Version 1 of PosModes


Ignore:
Timestamp:
Aug 23, 2012, 9:34:56 AM (12 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PosModes

    v1 v1  
     1[[PageOutline]] 
     2 
     3= Positioning Modes 
     4 
     5== What are positioning modes? 
     6 
     7The term "Positioning Mode" means an algorithm which is used for calculating token positions in source code files by the RefactorErl tool. 
     8There are two different positioning modes in RefactorErl. These are the so-called absolute and relative modes. It is available to choose which one to be used. 
     9 
     10 
     11== Why to choose positioning mode and how to do it? 
     12 
     13It is a very useful feature that we can choose which positioning mode we want to use because it allows us to fine-tune RefactorErl so we can boost performance. Before we start the tool, we have to decide for what we would like to use it. There are some very easy principles: 
     14 
     15* If we do not want to use refactoring functions we should use absolute positioning (for example we only want to use queries) 
     16* If we refactor a lot we should consider using relative positioning 
     17* If we know that we will only change some words in our files or only modify the beginning of the files (eg. comments) we should use relative positioning 
     18 
     19If none of the above is true then we can use the default (absolute) positioning. 
     20 
     21To start the tool with absolute positioning we should simply type ''bin/referl'' (this is the default) or type ''bin/referl -pos abs''. To start the tool with relative positioning we should type ''bin/referl -pos rel''. 
     22The chosen positioning mode belongs to the database and its content that we load so we have to reset the database and restart the tool with another pos option to change positioning mode or we can also use ''ri:reset/1'' with the following parameters: rel, abs.  
     23To make it clear, lets see an easy example: if we start the tool with -pos rel and load up some directories we will have a database content with relative positioning. If we restart the tool without resetting it and using -pos abs nothing will happen, we will also have to use our relatively positioned database. If we want to setup positioning again, we have to use ri:reset/1 or ri:reset/0 and restart it. 
     24 
     25 
     26== How do positioning modes work? 
     27 
     28=== Absolute mode 
     29 
     30In this mode, we store an absolute position for every token which means a little bit bigger database size but a very fast position calculation. If we refactor or change in a file some token positions have to be recalculated. "Some tokens" means many times hundreds of tokens. This recalculation makes RefactorErl slower. 
     31 
     32=== Relative mode 
     33 
     34In this mode, we store an absolute position for every form and a relative one for every token in it. This grants us a relatively fast recalculation and an average position calculation. 
     35