RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/WisdmLabs/moodle-local_edwiserreports-free

Cursor rule

.cursor/rules/moodle-performance-optimization.mdc

[object Object]

Cursor rules

Quality

50/100

Scores the file, not the repository.

Length

289 words

5 headings · 1 code blocks

Repository

4

— · pushed 2 days ago

Last changed

3 days ago

First indexed 3 days ago.
WisdmLabs/moodle-local_edwiserreports-free/.cursor/rules/moodle-performance-optimization.mdcRawGitHub
1---
2description:
3globs:
4alwaysApply: false
5---
6# Moodle Performance Optimization
7 
8## Purpose
9Ensure PHP code follows Moodle performance best practices for optimal execution speed and resource usage.
10 
11## Instructions
12When writing PHP code for Moodle, implement these performance optimizations:
13 
141. **Database Queries**: Minimize database calls, use bulk operations when possible
152. **Caching**: Use Moodle's caching API (`cache::make()`) for expensive operations
163. **Memory Management**: Avoid loading large datasets into memory, use pagination
174. **File Operations**: Use Moodle's file API, avoid direct file system access
185. **Session Handling**: Minimize session writes, use `$SESSION` sparingly
196. **Output Buffering**: Use `ob_start()` and `ob_end_flush()` for large outputs
207. **Error Logging**: Use `debugging()` instead of `error_log()` in production
218. **Plugin Loading**: Lazy load plugins and dependencies when possible
22 
23## Examples
24 
25```php
26<?php
27// File: ./includes/performance_example.php
28 
29/**
30 * Example of performance-optimized code
31 */
32function get_optimized_course_data($courseids) {
33 global $DB;
34
35 // Use caching for expensive operations
36 $cache = cache::make('core', 'course_data');
37 $cachekey = 'course_data_' . md5(serialize($courseids));
38
39 $cacheddata = $cache->get($cachekey);
40 if ($cacheddata !== false) {
41 return $cacheddata;
42 }
43
44 // Bulk database query instead of multiple queries
45 list($insql, $params) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED);
46 $sql = "SELECT c.*, COUNT(e.userid) as enrolled_users
47 FROM {course} c
48 LEFT JOIN {enrol} e ON c.id = e.courseid
49 WHERE c.id $insql
50 GROUP BY c.id";
51
52 $courses = $DB->get_records_sql($sql, $params);
53
54 // Cache the result for 5 minutes
55 $cache->set($cachekey, $courses, 300);
56
57 return $courses;
58}
59 
60/**
61 * Efficient file handling
62 */
63function process_files_efficiently($contextid) {
64 $fs = get_file_storage();
65
66 // Use file iterator for large file sets
67 $files = $fs->get_area_files($contextid, 'mod_assign', 'submission');
68
69 foreach ($files as $file) {
70 if ($file->is_directory()) {
71 continue;
72 }
73
74 // Process file without loading entire content into memory
75 $content = $file->get_content();
76 // Process content in chunks if large
77 }
78}
79```
80 
81## Exceptions
82- Development environments may use different performance settings
83- Debugging may require bypassing some optimizations
84 

Sections

  • Moodle Performance Optimization
  • Purpose
  • Instructions
  • Examples
  • Exceptions

What it covers

performanceagent-behaviour

Stack — with the evidence

javascript

(1.00)

Glob targeting

  • [object Object]

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
WisdmLabs
Language
—
License
—
Archived
no

All configs in this repo

Also in WisdmLabs/moodle-local_edwiserreports-free

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-ajax-and-js-integration.mdc · 4Cursor rulesjavascriptagent-behaviour50/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-configuration-management.mdc · 4Cursor rulesjavascriptagent-behaviour36/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-database-patterns.mdc · 4Cursor rulesjavascriptstyledatabaseagent-behaviour54/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-error-handling.mdc · 4Cursor rulesjavascriptagent-behaviour50/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-events-and-callbacks.mdc · 4Cursor rulesjavascriptagent-behaviour50/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-file-and-media-handling.mdc · 4Cursor rulesjavascriptagent-behaviour36/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-internationalization.mdc · 4Cursor rulesjavascriptagent-behaviour36/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-php-coding-standards.mdc · 4Cursor rulesjavascriptagent-behaviour50/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-plugin-structure.mdc · 4Cursor rulesjavascriptarchagent-behaviour54/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-scheduled-tasks.mdc · 4Cursor rulesjavascriptagent-behaviour50/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-security-practices.mdc · 4Cursor rulesjavascriptsecurityagent-behaviour50/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-testing-and-quality.mdc · 4Cursor rulesjavascripttesttesting-strategyagent-behaviour54/1003 days ago
WisdmLabs/moodle-local_edwiserreports-free.cursor/rules/moodle-web-services-and-api.mdc · 4Cursor rulesjavascriptapiagent-behaviour50/1003 days ago
Diff against .cursor/rules/moodle-ajax-and-js-integration.mdc Diff against .cursor/rules/moodle-configuration-management.mdc Diff against .cursor/rules/moodle-database-patterns.mdc Diff against .cursor/rules/moodle-error-handling.mdc Diff against .cursor/rules/moodle-events-and-callbacks.mdc Diff against .cursor/rules/moodle-file-and-media-handling.mdc Diff against .cursor/rules/moodle-internationalization.mdc Diff against .cursor/rules/moodle-php-coding-standards.mdc Diff against .cursor/rules/moodle-plugin-structure.mdc Diff against .cursor/rules/moodle-scheduled-tasks.mdc Diff against .cursor/rules/moodle-security-practices.mdc Diff against .cursor/rules/moodle-testing-and-quality.mdc Diff against .cursor/rules/moodle-web-services-and-api.mdc

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack