- Rexx 教程
- Rexx - 首頁
- Rexx - 概述
- Rexx - 環境
- Rexx - 安裝
- Rexx - 外掛安裝
- Rexx - 基本語法
- Rexx - 資料型別
- Rexx - 變數
- Rexx - 運算子
- Rexx - 陣列
- Rexx - 迴圈
- Rexx - 決策
- Rexx - 數字
- Rexx - 字串
- Rexx - 函式
- Rexx - 棧
- Rexx - 檔案 I/O
- Rexx - 檔案函式
- Rexx - 子程式
- Rexx - 內建函式
- Rexx - 系統命令
- Rexx - XML
- Rexx - Regina
- Rexx - 解析
- Rexx - 訊號
- Rexx - 除錯
- Rexx - 錯誤處理
- Rexx - 面向物件
- Rexx - 可移植性
- Rexx - 擴充套件函式
- Rexx - 指令
- Rexx - 實現
- Rexx - Netrexx
- Rexx - Brexx
- Rexx - 資料庫
- 手持式和嵌入式
- Rexx - 效能
- Rexx - 最佳程式設計實踐
- Rexx - 圖形使用者介面
- Rexx - Reginald
- Rexx - Web 程式設計
- Rexx 有用資源
- Rexx - 快速指南
- Rexx - 有用資源
- Rexx - 討論
Rexx - 效能
任何程式語言的關鍵方面之一是應用程式的效能。需要特別注意以確保應用程式的效能不受影響。讓我們看看為更好地理解而分步驟描述的一些注意事項:
步驟 1 - 嘗試減少指令數量 - 在 Rexx 中,每個指令都會產生開銷。因此,嘗試減少程式中的指令數量。下面顯示了可以重新設計的指令示例。
與其使用多個 if else 語句,不如使用 parse 語句。因此,在以下程式中,與其為每個值設定 if 條件,並獲取 word1、word2、word3 和 word4 的值,不如使用 parse 語句。
/* Main program */ parse value 'This is a Tutorial' with word1 word2 word3 word4 say "'"word1"'" say "'"word2"'" say "'"word3"'" say "'"word4"'"
步驟 2 - 嘗試將多個語句合併為一個語句。下面顯示了一個示例。
假設您有以下程式碼,它為 a 和 b 賦值並將它們傳遞給名為 proc 的方法。
do i = 1 to 100 a = 0 b = 1 call proc a,b end
您可以輕鬆地使用 parse 語句將上面給出的程式碼替換為以下程式碼。
do i = 1 for 100 parse value 0 1 with a, b, call proc a,b end
步驟 3 - 儘可能用 do..for 迴圈 替換 do..to 迴圈。當控制變數在迴圈中迭代時,通常建議這樣做。
/* Main program */ do i = 1 to 10 say i end
上面程式應替換為以下程式。
/* Main program */ do i = 1 for 10 say i end
步驟 4 - 如果可能,從 do 迴圈中刪除 for 條件,如下面的程式所示。如果不需要控制變數,則只需在 do 迴圈中放入結束值,如下所示。
/* Main program */ do 10 say hello end
步驟 5 - 在 select 子句 中,您認為將被評估的最佳條件需要放在 when 子句 中的第一個位置。因此,在以下示例中,如果我們知道 1 是最頻繁的選項,我們將 when 1 子句 作為 select 語句中的第一個子句。
/* Main program */ select when 1 then say'1' when 2 then say'2' otherwise say '3' end
廣告